Introduction
When trying to start or stop Apache you may see errors like "Error: Too many open files" and needs to be increased.
Procedure
On a server using systemd to manage services do the following:
mkdir /usr/lib/systemd/system/httpd.service.d
Then create a file with a .conf extension like mkdir /usr/lib/systemd/system/httpd.service.d/limits.conf and add the following:
[Service]
LimitNOFILE=40000
Then run these to reload the change and restart Apache:
systemctl daemon-reload
/scripts/restartsrv_httpd --hard
If this doesn't work then directly modify /usr/sbin/apachectl and comment out the following section:
#if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
# $ULIMIT_MAX_FILES
#fi
Then just after that add this line with the limit needed:
ulimit -n 40000
and then restart Apache again with:
/scripts/restartsrv_httpd --hard
You can use the following article to check what limits are set for Apache processes:
How to check the configured number of open files allowed for Apache
Comments
0 comments
Article is closed for comments.