faryar76
faryar76

Reputation: 168

shell_exec in php stil working after disconect?

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

Answers (1)

Enrico Dias
Enrico Dias

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

Related Questions