|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Asynchronous PHP Execution
>
and exec/shell (but that > >doesn't seem to be asynchronous), but neither seems optimal. >> > It can be if you redirect the output streams and put an ampersand after it: > <?php exec('sleep 5 /dev/null 2>/dev/null &'); echo 'Script ended'; ?> > This tiny sample should end immediately, and the sleep command should run on regardless. > Thanks so much for the suggestion, that's what I ended up doing and it worked, after some fiddling. Just as a side note, does it execute from the current directory of the file? Previously, I tried calling exec('php scripts/foo.php'), but it seemed like there was some weird interaction between different required files. E.g., this was the layout: orig.php scripts/foo.php incl.php orig.php had the exec line, and foo.php had require_once(/incl.php). But it seemed like the exec call caused foo.php to execute from the scripts directory while the require_once caused incl.php to also execute from the scripts directory. How does php determine what the working directory is? |
![]() |
| Viewing: Web Development Archives > Mailing Lists > PHP > Asynchronous PHP Execution |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|