PHP failed to open stream: Too many open files PHP failed to open stream: Too many open files unix unix

PHP failed to open stream: Too many open files


Sounds like a long-running process is opening files and not closing them properly. Do you have any ideas which process might be doing that? Are you doing something that you would expect to open a large number of files? Sounds like it could be an issue with your unit-testing library. I'm not familiar with behat; have you searched for this error specifically in relation to the libraries/software you're using? When you talk about "making a lot of request to the web server", are those all 'concurrent' requests, which might well cause lots of file handles to be opened?

Ultimately, I think you need to solve the problem - if it is, indeed, a problem - of opening way more files than you're expecting to.


You should increase the per user file limit for user running php processes. Check with which user your php processes are running and increase the limit for them. You can do like this.$ cat /etc/security/limits.conf * hard nofile 500000* soft nofile 500000root hard nofile 500000root soft nofile 500000www-data hard nofile 500000www-data soft nofile 500000

reference:https://rtcamp.com/tutorials/linux/increase-open-files-limit/


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.