RE: [PHP] Start php-script with exec()?
| From: | Jay Blanchard | Date: | Mon, 22 Sep 2003 13:04:14 +0000 |
| Subject: | RE: [PHP] Start php-script with exec()? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163460@lists.php.net to get a copy of this message | ||
[snip]
> As usual for *nix type 'which php' which will return the path to the
> PHP executable. For portability you could then do something to the
> effect of (not tested)
which() doesn't resolve the path, but I found out it was
/usr/local/php/bin/php.
But how do I make the call
exec("/usr/local/php/bin/php process1.php");
so that the page from which the call is made doesnt wait for the result
but instead just continues?
[/snip]
use & (not tested, but runs other processes as background processes)
exec("/usr/local/php/bin/php process1.php &");
From http://www.php.net/exec : If you start a program using
this function and want to leave it running in the background, you have to make sure that the output
of that program is redirected to a file or some other output stream or else PHP will hang until the
execution of the program ends.