10

Possible Duplicate:
Asynchronous shell exec in PHP
Is there a way to use shell_exec without waiting for the command to complete?

I want to run a quite slow / complex program which takes at least 10 minutes to complete. I want to call this via shell_exec or something similar, but I dont want the php script to wait for the completion of this program.

is thing something I can do? and if so how can I do that?

Community
  • 1
  • 1
nivanka
  • 1,332
  • 6
  • 23
  • 35
  • You can use Tasks https://github.com/jamm/Tasks module - special for delayed execution without waiting and without using `shell_exec`. Or you can read this answer: http://stackoverflow.com/questions/1019867/php-shell-execute-without-waiting-for-a-return/1019904#1019904 :) – OZ_ May 26 '11 at 14:22
  • I quite didnt understand this one – nivanka May 26 '11 at 14:27
  • http://stackoverflow.com/questions/45953/php-execute-a-background-process – ajreal May 26 '11 at 14:28
  • hi there - many thanks dear nivanka - thank you for this thread. it is very helpful. You have helped me alot. – zero May 19 '20 at 17:02

1 Answers1

21

This has been answered before at Asynchronous shell exec in PHP

Briefly:

shell_exec( $your_command . "> /dev/null 2>/dev/null &" );
Community
  • 1
  • 1
Mat
  • 6,416
  • 7
  • 31
  • 39