Plesk - Larger FD_SETSIZE

If you are getting and error like the following in the apache error:

"Unable to open logs"

Or the error:

Segmentation fault (11)
[warn] make_sock: problem listening on port 443, file descriptor (1068) larger than FD_SETSIZE (1024)

Unable to open logs
Too many open files

In this case you need to recompile OpenSSL, Apache, Imap and PHP from source RPM to increase FD_SETSIZE value. Please follow through the steps below.

Add the following lines to /etc/sysctl.conf:

fs.file-max = 131072

Run the following shell command:

# /sbin/sysctl -w fs.file-max=131072

Edit __FD_SETSIZE value in /usr/include/bits/types.h for RedHat 7.x or /usr/include/bits/typesizes.h and /usr/include/linux/posix_types.h for RedHat 9, Fedora Core, RHEL 2.1, 3, 4 (glibc-kernheaders and glibc-headers package has to have been installed before). If your system uses NPTL, you can find it with:

NPTL 2.3.4

then /usr/include/nptl/bits/typesizes.h header file also should be modified.

#define __FD_SETSIZE 131072

Download the following source RPM that could be found in other places such as or

libc-client-devel-*.src.rpm (if such RPM installed)


Recompile OpenSSL first. For example:

# /usr/bin/rpmbuild --rebuild openssl-0.9.7a-35.src.rpm

Install compiled OpenSSL RPM with the following command line:

# rpm -Uvh --force /usr/src/redhat/RPMS/i386/openssl-0.9.7a-35.i386.rpm

Repeat the same actions for CURL.

Recompile and install apache:

# rpmbuild --rebuild httpd-2.0.51-2.9.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-2.0.51-2.9.i386.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-devel-2.0.51-2.9.i386.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/mod_ssl-2.0.51-2.9.i386.rpm

Recompile and install libc-client library which is provided by imap or libc-client-devel packages (it depends on OS) . You have to recompile one that is installed in the system:

# /usr/bin/rpmbuild --rebuild imap-2002d-3.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/imap-devel-2002d-3.i386.rpm


# /usr/bin/rpmbuild --rebuild libc-client-devel.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/libc-client-devel.rpm

Recompile and install PHP:

# rpmbuild --rebuild php-4.3.10-2.4.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/php-*

Add 'ulimit -n 131072' command to /etc/rc.d/init.d/httpd and /usr/sbin/apachectl apache startup scripts before other commands.

Replace /usr/sbin/suexec with Plesk one:

# cp /usr/sbin/psa-suexec /usr/sbin/suexec
# /etc/init.d/httpd restart

Since Plesk 7.5:

# cp /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec
# /etc/init.d/httpd restart