Bug #63143 [Com]: http request never end
| From: | yubing at baixing dot com | Date: | Sun, 23 Sep 2012 16:46:02 +0000 |
| Subject: | Bug #63143 [Com]: http request never end | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173660@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63143&edit=1
ID: 63143
Comment by: yubing at baixing dot com
Reported by: yubing at baixing dot com
Summary: http request never end
Status: Open
Type: Bug
Package: Built-in web server
Operating System: CentOS 6.3 & Mac OSX
PHP Version: 5.4.7
Block user comment: N
Private report: N
New Comment:
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 ï¼ï¼
Previous Comments:
------------------------------------------------------------------------
[2012-09-23 15:08:10] laruence@php.net
sorry, I didn't get your point, you mean test2.php will never stop while host is
built-in server?
------------------------------------------------------------------------
[2012-09-23 14:59:40] yubing at baixing dot com
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 &
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63143&edit=1