1

I am having trouble setting the open files limit for user www-data and process PHP in Ubuntu 16.04.

I have set all the following to 65535:

  • /proc/sys/fs/file-max
  • /etc/sysctl.conf
  • /etc/security/limits.conf (both with asterisk (*) and explicitly with user www-data)
  • /etc/php/7.0/fpm/php-fpm.conf (and it works for PHP-FPM!)

Still, wenn I grab a php cli process from user www-data, and check via /proc//limits, it shows:

Limit Soft Limit Hard Limit Units Max open files 4096 4096 files

I have searched php.ini which doesn't have a similar setting as php-fpm.conf, so I just copied the one of php-fpm, to no avail as well.

Any ideas?

3
  • Could you please add to the question the output of for php_fpm_pid in $(pgrep php-fpm);do ps -fp $php_fpm_pid;cat /proc/$php_fpm_pid/limits|egrep 'Max open files|^Limit';echo;done ? – Mircea Vutcovici Aug 7 '20 at 15:18
  • Hello @MirceaVutcovici, thank your for trying to help. Here's is the output: pastebin.com/3VSZ08wv But to clarify, for PHP-FPM it does work. For PHP cli, it's not working. – Ascendor Aug 10 '20 at 6:42
  • Hello and welcome to Serverfault. I think you should add information on the "why" you need to have more than 4096 open files per process, as it may turn out to be unneeded or needing some other solution entirely different than the one you are trying to use – Olivier Dulac Aug 18 '20 at 6:38
0

The solution was to change the parameter DefaultLimitNOFILE on files /etc/systemd/user.conf and /etc/systemd/system.conf.

Found on https://www.it-swarm.dev/de/linux/open-file-limit-kann-nicht-ueber-4096-erhoeht-werden-ubuntu/944917651/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.