Resolution
Apache and apache modules come with Plesk for FreeBSD versions prior v8.1.0 and are already compiled with FD_SETSIZE = 16384 and if you have problem with file descriptors lack then the reason is in some non-Plesk system application. The most probably it is related to standard system OpenSSL libraries which are dynamically loaded by Plesk's apache. To have the system OpenSSL library files be recompiled with increased FD_SETSIZE value, please do the following.- obtain FreeBSD sources for your FreeBSD version, for example using `cvsup` utility. See "Obtaining FreeBSD" in the FreeBSD HandBook for details. We would recommend that you obtain not original sources for exactly the same FreeBSD release that you are currently running, but updated sources from STABLE branch for your FreeBSD version.
- edit /usr/src/sys/sys/select.h and /usr/include/sys/select.h files and modify there FD_SETSIZE value from 1024U to to 16384U:
#ifndef FD_SETSIZE
#define FD_SETSIZE 16384U
File /usr/include/sys/select.h is used for third-party software compilations, for example from ports collection, we will not use it at current moment, but it may be useful for you in the future. The file /usr/src/sys/sys/select.h will be used by us during our compilations from FreeBSD sources.
- run the following commands to recompile all the system files including OpenSSL libraries:
# rm -rf /usr/obj/usr
# cd /usr/src
# make clean ; make cleandepend
# make buildworld- now actually it is a good chance to update not only OpenSSL libraries but also system binaries and libraries and also update/modify the kernel. If you wish to do this and continue with system/kernel update, please follow "The Cutting Edge" chapter in FreeBSD HandBook for the rest of details.
- if your system/kernel is up-to-date or you don't need to update anything except OpenSSL libraries for other reason, you can find what files are used by apache and replace them manually with new copies. Below is example for FreeBSD 6.0:
# ldd /usr/local/psa/apache/bin/httpd
/usr/local/psa/apache/bin/httpd:
libaprutil-0.so.9 => /usr/local/psa/apache/lib/libaprutil-0.so.9 (0x281cb000)
libapr-0.so.9 => /usr/local/psa/apache/lib/libapr-0.so.9 (0x281dd000)
libm.so.4 => /lib/libm.so.4 (0x281f8000)
libcrypt.so.3 => /lib/libcrypt.so.3 (0x28211000)
libssl.so.4 => /usr/lib/libssl.so.4 (0x28229000)
libcrypto.so.4 => /lib/libcrypto.so.4 (0x28257000)
libz.so.3 => /lib/libz.so.3 (0x2834e000)
libc.so.6 => /lib/libc.so.6 (0x2835e000)So that in our FreeBSD 6.0 case these files are
/lib/libcrypt.so.3
/lib/libcrypto.so.4
/usr/lib/libssl.so.4
make backup copies of them just in case:
# cp -p /lib/libcrypt.so.3 /lib/libcrypt.so.3.back ; \
cp -p /lib/libcrypto.so.4 /lib/libcrypto.so.4.back ; \
cp -p /usr/lib/libssl.so.4 /usr/lib/libssl.so.4.backAnd replace them with copy newly compiled copies (they are located in /usr/obj/usr/src/ subfolders). If you use remote connection to server console, execute the below commands as a single command (as shown in the example below) as your current ssh connection may be dropped or hang:
# cd /usr/obj/usr/src/ ; \
cp ./secure/lib/libcrypto/libcrypto.so.4 /lib/libcrypto.so.4 ; \
cp ./secure/lib/libssl/libssl.so.4 /usr/lib/libssl.so.4 ; \
chflags noschg /lib/libcrypt.so.3 ; \
cp ./lib/libcrypt/libcrypt.so.3 /lib/libcrypt.so.3 ; \
chflags schg /lib/libcrypt.so.3- then reboot the server
Keywords: FD_SETSIZE apache php freebsd recompile openssl