phpunixnginx

PHP failed to open stream: Too many open files


I have a problem with the error: PHP failed to open stream: Too many open files.

I have looked on various answers here on stackoverflow, but I am unable to solve this issue. I have mainly tried to increase the limit of max. open files:

I have edited /etc/security/limits.conf where I specified this:

*       soft    nofile      10000
*       hard    nofile      30000

After saving and logging out / rebooting the box, the command:

ulimit -n

Still prints out 1024. I am not sure why this has no effect and I think this is the reason I get the php error. If needed I can paste the whole file or any other configuration file. I am using PHP 5.6, nginx 1.8.0 and php-fpm.

The solution which works for me now is to manually restart nginx with:

service nginx restart

After this things work again. Mainly the problem occurs when I run unit tests, behat tests or when I make a lot of requests to the web server.


Solution

  • The solution was to do vagrant halt and then vagrant ssh again. Then it printed out the 10000. Looks like simple logout and login with the user was not enough for some reason.