Apache: (24)Too many open files: couldn’t spawn child process:

Published by

Posted on February 15, 2009

Error : 

(24)Too many open files: couldn’t spawn child process: 

Running the command 

su -s /bin/sh apache -c “ulimit -n”

will show you the ulimit for apache wich is 1024 by default on most linux servers 



I had a look at the system, and found that it was hitting the limit of 1024 files open in Apache. Most were used up by web log files, two for each domain. The solution is to increase the number of open files, by adding a ulimit -n 8000 statement to /etc/init.d/httpd .

Failing that, another option would be to turn off the per-domain error log files. This can be done by manually editing /etc/httpd/conf/httpd.conf (or wherever they are stored) and removing the ErrorLog line in each domain’s <virtualhost> section, then restarting Apache. Then in Virtualmin, go to System Settings ? Server Templates ? Default Settings ? Apache website, and take the ErrorLog line out of the ‘Directives and settings for new websites’ field.


Thanks to Jamie at
Good Reference