Restarting Apache on my MacBook Pro today, using the command line argument
sudo apachectl -k start resulted in a rather strange error:
/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
After a little investigating it turned out to be caused by an update in the
apachectl script to OSX 10.6.5.
ULIMIT_MAX_FILES variable increases the maximum number of file descriptors allowed per child process. This is critical for configurations that use many file descriptors, such as mass vhosting, or a multithreaded server.
A quick edit of the the
apachectl script and it’ll be back working.
I use TextMate, so the command is:
sudo mate /usr/sbin/apachectl
You’ll be prompted for your password.
apachectl file is open, look for the following line (for me it was line 64):
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
and replace with the following:
ULIMIT_MAX_FILES="ulimit -S -n"
This will set the correct command that increases the maximum number of file descriptors allowed per child process.