“ERROR: failed to prepare the stderr pipe: Too many open files (24)”
How do I fix this problem?
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
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |