Search

Language:  
Search for:

Available article translations:

How to recompile Apache, PHP, and IMAP with increased value of file descriptors larger than FD_SETSIZE (1024) on a RedHat-like system?

Article ID: 260 
Created On: Oct 5, 2008
Last Review: Apr 15, 2012
Views:
Was this article helpful?
No Yes
APPLIES TO:
  • Parallels Plesk Panel 10.x for Linux
  • Parallels Plesk Panel 9.x for Linux/Unix
  • Parallels Plesk Panel 8.x for Linux/Unix
  • Plesk 7.5.x Reloaded
  • Plesk 7.1.x Reloaded
  • Plesk 7.0.x
  • Plesk 6.x

Symptoms

RPM packages are compiled by vendors with too small (1024) a number of file descriptors, and it might cause the following messages to appear in the /var/log/httpd/error_log:

    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

This is a common Apache issue on servers with many Virtual Hosts configured. See this article for more information: http://httpd.apache.org/docs/2.0/misc/descriptors.html.

Resolution

NOTE: Since Plesk 8.2.0, up to 900 domains can be hosted on the OS vendor Apache build without the system packages recompilation described in this article. If the Piped Logs feature is enabled on the Plesk server,  see 2066.

NOTE: This article is for Linux operation systems that have RPM packages structure, such as RHEL, Fedora, CentOS, SUsE.
For details on the Debian system, please see this article.
For details on the FreeBSD system, please see this article.


NOTE: Plesk requires, closely depends on, and uses many server applications which are not actually part of Plesk software. For example, the apache web server, mysql server, php module and binaries, and many others are not compiled by Parallels and not provided by Parallels, but standard system RPM packages from the operating system vendor are used by Plesk 'as is'. This allows the administrator to upgrade and recompile such packages with the desired options. This article is written to help administrators of Plesk configure their OS and system packages that are not included in the Plesk distributive to use with a large number of hosted domains.

You need to recompile related applications and libraries such as openssl, apache, imap, PHP, etc, from source RPMs with increased FD_SETSIZE value. Please follow these steps:

Make sure that the system allows you to open enough files:
# /sbin/sysctl fs.file-max
fs.file-max = 131072

If fs.file-max is quite small (several thousand or so), it should be changed by adding the following lines to /etc/sysctl.conf:

fs.file-max = 131072

and running the shell command:
# /sbin/sysctl -w fs.file-max=131072


NOTE: if you are running Virtuozzo, you have to adjust fs.file-max on the hardware node and it will be applied to all VEs.

You should have glibc-kernheaders and glibc-headers packages installed. They can be taken from the operating system distributive CD or from your operating system's download sites. Edit the __FD_SETSIZE value in the typesizes.h and posix_types.h files that can be found with:
# find /usr/include/ -name typesizes.h
# find /usr/include/ -name posix_types.h

and set it as:

#define __FD_SETSIZE 65536

Download the following source RPMs that can be found on your operating system's download sites or similar places. You may use RPM search engines such as http://rpm.pbone.net or http://rpmfind.net:

openssl-*.src.rpm
httpd-*.src.rpm
imap-*.src.rpm
php-*.src.rpm
libc-client-devel-*.src.rpm (if such RPM is installed)
curl-*.src.rpm

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 (depends on OS) . You have to recompile one that is installed in the system. For example:
# /usr/bin/rpmbuild --rebuild imap-2002d-3.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/imap-devel-2002d-3.i386.rpm

or
# /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. For example:
# rpmbuild --rebuild php-4.3.10-2.4.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/php-*

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

Replace /usr/sbin/suexec with a Plesk one:
# cp /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec
# /etc/init.d/httpd restart

Use the following commands for Plesk versions earlier then 7.5:
# cp /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec
# chown root:apache /usr/sbin/suexec
# chmod 4510 /usr/sbin/suexec
# /etc/init.d/httpd restart





64d8d09669cff87d685a09b84f40c490 75b59b1c6cdbaf382ebb2e4d11777032 49af2da0f2dd4c81e962790bbbd0c2b4 5d735c0e028ee5b991e4fb80d34fb87f aa571057eefb4e790d223bad9e05ace1 097728dc0a325f6309aa7a3997d4cacc 0324051e74e0392d1551a3b559b09eaa 6eab23e8dac1eb5df9820a41f94cf4b4 d3cd9f1770da96e5b5046d20def9f8eb 6ef964a54451eeb60b9cce8b8001a1d4 56797cefb1efc9130f7c48a7d1db0f0c

Was this article helpful?
No Yes
 
 
 
 
 
 
For Home
For Hosters
For SaaS
For IaaS
 
Desktop Virtualization
- Parallels Desktop 8 for Mac
- Parallels Transporter
- Parallels Mobile
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac Enterprise Edition
- Parallels Management-Mac for Microsoft SCCM
Server Virtualization
- Parallels Cloud Server
- Parallels Virtuozzo Containers
Automation
- Parallels Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Web Presence Builder
- Parallels Plesk Automation
- Parallels Small Business Panel
- Parallels Domain/SSL Reseller Program
- Value-added Services for Hosters
- Parallels Partner Storefront