So I do some work on Apache on my Powerbook... change around some settings, add SSL for some tests I am doing and suddenly I'm getting this error:
line 70: ulimit: open files: cannot modify limit: Invalid argument
Apache starts normally, and everything seems to run, but it's weird and I don't like it. Digging around a bit, I found an obscure post pointing me in this direction: apachectl (which is what I use to start Apache) is a shell script. On line 70, it is attempting to reset the ULIMIT_MAX_FILES when Apache starts.
Looking at the shell script, we see this:
60 # Set this variable to a command that increases the maximum
61 # number of file descriptors allowed per child process. This is
62 # critical for configurations that use many file descriptors,
63 # such as mass vhosting, or a multithreaded server.
64 ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
65 # -------------------- --------------------
66 # |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
67
68 # Set the maximum number of file descriptors allowed per child process.
69 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
70 $ULIMIT_MAX_FILES
71 fi
Line 64 is creating the command to set the ULIMIT for us. It essentially says to run the command ulimit -H -n and the answer of that goes into the string ulimit -S -n - trying to set the soft limit for Apache to the hard limit of the system. The problem, is that OS-X, like AIX and some Solarises, return the value "unlimited" for the number of file descriptors, which cannot be used in the command ulimit -S -n, so we get the syntax error "cannot modify limit: Invalid argument" when we try to start Apache. Since the command fails to do anything, and since the file descriptors for Apache is unlimited, this is a no-damage error and Apache starts normally anyway.
But if it bothers you (like it did me) then all you need to do is comment out lines 69, 70 and 71 because they are meaningless to OS-X and it'll start up without complaint.
After a day of niggily little bastards like this one, figured I'd post about it and hope I eased up someone else's day
