|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63143 http request never end
Submitted: 2012-09-23 14:59 UTC Modified: 2012-09-25 10:09 UTC
Avg. Score:4.1 ± 0.9
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:0 (0.0%)
From: yubing at baixing dot com Assigned:
Status: Wont fix Package: Built-in web server
PHP Version: 5.4.7 OS: CentOS 6.3 & Mac OSX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: yubing at baixing dot com
New email:
PHP Version: OS:


 [2012-09-23 14:59 UTC] yubing at baixing dot com
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 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:
    exec('ping -c 100 > /dev/null 2>&1 &',$output, $code);
    exec('',$output, $code);
  ping -c 100 > /dev/null 2>&1 &


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-23 15:08 UTC]
sorry, I didn't get your point,  you mean test2.php will never stop while host is 
built-in server?
 [2012-09-23 16:46 UTC] yubing at baixing dot com
the php run to the end successfully (but I'm not sure if it's stoped in the php engine), but the tcp connection for http request will be hanging until the ping cmd under shell ends.

If you can help to do a test using the code I wrote, you may get the problem quikely.

Or if you still can't get the meaning of the bug, I can send the chinese version of description to your weibo private message, nice to see you Laruence :)
 [2012-09-23 17:34 UTC] yubing at baixing dot com
I've find a work round for this situation:
Add an "Content-Length" header, then the browser will close the http connection instead waiting for further content.
 [2012-09-25 10:09 UTC]
-Status: Open +Status: Wont fix
 [2012-09-25 10:09 UTC]
the socket is not closed due to the exec, even the script finished

so, IMO, in built-in server side, won't fix. :)

 [2017-09-17 11:15 UTC] mintystark at gmail dot com
I am also having this problem.
unfortunately, adding "Content-Length" wont allow any output from php.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 30 05:01:24 2023 UTC