PHP Warning: exec() unable to fork

Process limit

“Is there a process limit I should look into”

It’s suspected somebody (system admin?) set limitation of max user process. Could you try this?

$ ulimit -a
....
....
max user processes              (-u) 16384
....

Run preceding command in PHP. Something like :

echo system("ulimit -a");

I searched whether php.ini or httpd.conf has this limit, but I couldn’t find it.

Error Handling

“even a better way to handle these processes as to get around the error all together?

The third parameter of exec() returns exit code of $cmd. 0 for success, non zero for error code. Refer to http://php.net/function.exec .

exec($cmd, &$output, &$ret_val);

if ($ret_val != 0)
{
    // do stuff here
}
else
{
    echo "success\n";
}

Leave a Comment