PHP exec() Unable to Fork

PHP exec() Unable to Fork

I have a private, non-Internet connected server that runs an application. I point out that it's not Internet facing because it's not running in safe mode due to some of the things the app needs to do.

One of the things some calls will do is cause it to fire off a command line app using exec().

For some reason things started failing today, and I noticed the following in my logs:

PHP Warning:  exec(): Unable to fork [someapp] in somefile.php on line 177

My main symptom - none of the web requests to it were even hitting the Apache logs, and the server would not return a response at all, it would just close the connection. It's strange, because this and 5 other servers just like it have been humming along just fine without a hiccup. In fact this particular server has an uptime of 386 days.

The resolution to the error? Restart Apache. I probably would have restarted the entire server, but I'm actually in the process of migrating that data to a new application server so there's no pressing need.

Posted by Tony on Mar 27, 2012 | Servers