httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jørn <>
Subject [users@httpd] Apache/php: Max number of open files
Date Tue, 21 Aug 2018 18:37:30 GMT

I'm struggeling with the maximum number of open files in a php script executed through the

apache web server.

I have done two tests - one from shell and one through the apache web server. Both tests 
open as many files as possible in a given folder (named a-00001.dat, a-00002.dat and so 

The initial test resulted in 1006 open files through the apache web server, and about 1020

from the shell.

By playing with the /etc/security/limits.conf and /etc/sysctl.conf I managed to increase 
the number of files from the shell to about 2000 (then the limit was set to 8190 files 
(soft limit was 8192 in /etc/security/limits.conf).

But through the apache web server, it is still only 1006.

The content of /etc/security/limits.conf:
* soft nofile 8192
* hard nofile 16348
apache soft nofile 8192
apache hard nofile 16348

The apache web server was restarted after I changed the /etc/security/limits.conf file.

I executed 'print_r(posix_getrlimit())' in a php script through the apache web server and

got this output:
    [soft core] => unlimited
    [hard core] => unlimited
    [soft data] => unlimited
    [hard data] => unlimited
    [soft stack] => 8388608
    [hard stack] => unlimited
    [soft totalmem] => unlimited
    [hard totalmem] => unlimited
    [soft rss] => unlimited
    [hard rss] => unlimited
    [soft maxproc] => 62856
    [hard maxproc] => 62856
    [soft memlock] => 65536
    [hard memlock] => 65536
    [soft cpu] => unlimited
    [hard cpu] => unlimited
    [soft filesize] => unlimited
    [hard filesize] => unlimited
    [soft openfiles] => 1024
    [hard openfiles] => 4096

For me it seems like php is setting a limit, or??

I'm using php 7.0.25 and apache 2.4.27

Jørn Dahl-Stamnes

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message