0

I'm trying to change the file descriptor limits for Apache.

The problem is that the limits set through "/etc/security/limits.conf" don't apply to system users like "apache" with no login shell.

I've tested it with this simple PHP code:

<?php
echo "User: ";
echo exec('whoami');
echo "<br>FD Soft Limit: ";
echo exec('ulimit -Sn');
echo "<br>FD Hard Limit: ";
echo exec('ulimit -Hn');
?>

I've also tried to modify a variable from "/usr/sbin/apachectl":

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

OS: CentOS release 6.4 (Final) Apache: Apache/2.2.15

1

Are you hitting a ceiling of 1,024 file descriptors?

In CentOS/RHEL 6, a new ceiling was introduced by way of /etc/security/limits.d/90-nproc.conf.

This file (and anything in this directory) takes precedence over /etc/security/limits.conf, as it's applied after limits.conf is initially read; and its default is 1,024.

See the history of this via Red Hat Bugzilla, Bug ID #432903.

| improve this answer | |
  • Thanks for reply. Yes, I hit the limit bash: cannot make pipes for command substitution: Too many open files in system. I've tried to change these values in /etc/security/limits.d/90-nproc.conf. however the PHP script still show the defaults (1024/4096)? – HTF Mar 27 '13 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.