tags:

views:

21

answers:

1

I'm trying to do a potentially long background process in response to an incoming AJAX request, but using nohup or setsid via shell_exec causes the server to fork bomb. We use suexec and FastCGI, and when it bombs it took the entire server to a crawl.

shell_exec("nohup /home/me/myscript.php");

The script doesn't do anything lengthy right now, just outputs to an non-existant file (which never happens, because it blows up first)

Thanks!

A: 

I've always seen the warnings at http://php.net/manual/en/intro.pcntl.php (although you're using nohup, I knoẁ) as a warning that forking from webserver processes is not a safe way to go. If a background process needs starting, I'll create a daemon / always running job process which can receive such requests (and hasn't got anything to do with the webserver), which forks/nohups at will.

Wrikken