For a small school project I’m working on a site where you can monitor certain gameservers. I receive the server’s info via the github project GameQ which uses seperate class files which are loaded by an Autoloader php script. Now I’ve got a list of roughly 10.000 server ips which I’m trying to monitor with GameQ, but when I try to run the script it gives me the following error:
Warning: require(/httpdocs/game/src/GameQ/Exception/Query.php): failed to open stream: Too many open files in /httpdocs/game/src/GameQ/Autoloader.php on line 58
I already tried it with 1000 ip addresses and this was working fine. But when I increase the list to 1500 it gives me the error. It seems that the limit somewhere is set to 1024 but whatever I tried I can’t seem to find out where.
Here’s a list of things I already tried to increase the limit to 200000:
- sysctl -w fs.file-max=200000 and also added this line to /etc/sysctl.conf
-
Added this to the file /etc/security/limits.conf:
root soft nofile 200000 root hard nofile 200000
-
Added session required pam_limits.so to /etc/pam.d/login
-
Added ulimit -n 200000 to /etc/sysconfig/httpd
Since there weren’t any more options I could find on the net and here on stackoverflow I’m getting pretty desperate how I will ever solve this so I hope anyone knows how to fix this or knows what I’m doing wrong here. My server is running on CentOS 7 and I use Plesk for the website management.
2
Answers
It may be the case that your process is not running as root. If that’s the case, then limits you set in limits.conf will need to change the domain.
You can also confirm your process limits like this:
Check what the process limits actually are:
and then
Probably that is associated with user ID – meaning you should put the associated application ID instead of root in limits.conf.
In my case, I just added two more lines at /etc/security/limits.conf like below.
For more helps, please refer http://qsok.com/x/LIAV