Linux allowed open files limit differs between CGI and CLI

view story

http://stackoverflow.com – I'm having problems with my open files limits when running my script through command line vs through apache. My apache server is running under the user "apache" and it has its limits overridden in the /etc/security/limits.conf file as follow: apache soft nofile 10240 apache hard nofile 40960 I've got a simple script that I use for testing: <?php system('whoami'); system('ulimit -a | grep open'); When I hit this script through my browser I get: apache open files (-n) 1024 But when I run it in command line under user apache I get: [reza@app pdf]$ sudo -u apache (HowTos)