PHP-fpm Too Many Open Files 24 Error

You need to set open file descriptor rlimit for the PHP master process. The default value is system defined but one can increase it as per needs.

php-fpm too many open files error and solution

Edit php-fpm.conf
# vi /etc/php/7.0/fpm/php-fpm.conf
Find rlimit_files
;rlimit_files = 1024
And update it as follows (or as per your need):
rlimit_files = 4096
Save and close the file. Restart php7-0.fpm, run:
# systemctl restart php7.0-fpm

Increase FD limit at the OS level

Find user/group name:
$ grep ^user /etc/php/7.0/fpm/pool.d/www.conf
$ grep ^group /etc/php/7.0/fpm/pool.d/www.conf

www-data
www-data

Edit /etc/security/limits.conf, enter:
# vi /etc/security/limits.conf
Append as follows (replace user/group name with your actual names):

www-data       soft    nofile  4096
www-data       hard    nofile  4096

Restart required process. Save and close the file. Verify it:
$ su - www-data
To see the hard and soft values, issue the command as follows:
$ ulimit -Hn
$ ulimit -Sn

Reference: www.cyberciti.biz

RELATED POSTS
Share the Post: