0

I am running a PHP script that uses the passthru function to run system commands in the background. By redirecting the output and putting the & at the end of the command, the script is able to continue executing without waiting for the system command to finish. However, the PHP script itself does not exit until all commands are complete. Is there a way that the PHP script can start a system command and then not have to wait for that command to finish before exiting?

1 Answer 1

3

Have you tried using nohup?

Instead of

my_command >/dev/null &

do

nohup mycommand >/dev/null &
Sign up to request clarification or add additional context in comments.

1 Comment

Even with nohup, the PHP script will not exit until the system command is finished, although the rest of the script has completed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.