|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-09-23 15:08 UTC] laruence@php.net
[2012-09-23 16:46 UTC] yubing at baixing dot com
[2012-09-23 17:34 UTC] yubing at baixing dot com
[2012-09-25 10:09 UTC] laruence@php.net
-Status: Open
+Status: Wont fix
[2012-09-25 10:09 UTC] laruence@php.net
[2017-09-17 11:15 UTC] mintystark at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
Description: ------------ I try to use php built-in to run some shell command like: apachectl restart But I find that, if i start a new process by using exec()/passthru()/shell_exec() funcion, the http request will never close until I kill the process started in php . I‘ve already tried to append "> /dev/null 2>&1 &" to the command (as test1.php below) or but the command to a shell script (as test2.php and ping.sh below) but the http request still not close before the process ends. It's ok to run the same code under Apache or pure php cli. So I think it should be a bug of the php built-in web server, hope someone can fix it~ Test script: --------------- test1.php: <?php exec('ping -c 100 google.com > /dev/null 2>&1 &',$output, $code); var_dump($output,$code); ?> -------------------------------------- test2.php: <?php exec('ping.sh',$output, $code); var_dump($output,$code); ?> ping.sh: #!/bin/bash ping -c 100 google.com > /dev/null 2>&1 &