Reputation: 168
How does the shell_exec work in php? when I disconect the browser connection to the server, will the shell_exec continue working?
Upvotes: 0
Views: 48
Reputation: 1487
The php process will be terminated when the client closes the connection unless you use ignore_user_abort(1);
Also, the process needs to send something to the client to check if he is still connected. A process that has no output may continue to run after the client disconnects.
To execute a command in the background and keep it running after the php process ends, use something like this:
exec($cmd.' > /dev/null &');
Upvotes: 1