php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51271 CLI script + Sockets + Windows causes hang/pause at end of script execution
Submitted: 2010-03-11 02:45 UTC Modified: 2014-12-30 10:41 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: funnymonkeybanana at gmail dot com Assigned:
Status: No Feedback Package: CGI/CLI related
PHP Version: 5.2.13 OS: win32 only
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-03-11 02:45 UTC] funnymonkeybanana at gmail dot com
Description:
------------
I've experienced this problem for years but have never bothered to report it until now.  I write a lot of command-line PHP scripts and I've found that scripts that do not attempt to open a socket connection terminate immediately at the end of the program.  However, scripts that contact remote (or even 'localhost') servers (i.e. open a socket during script execution) hang for about 5 seconds before returning control to the command prompt.  I only experience this issue on Windows machines.  Linux and OSX boxes seem unaffected.

Test script:
---------------
<?php
	file_get_contents("http://www.google.com/");
	echo "Hi!\n";
?>

Expected result:
----------------
Return to the command prompt as soon as the "Hi!" is output.

Actual result:
--------------
Reaches the end of the script (after displaying "Hi!") and simply hangs for 5 seconds or so.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-11 21:09 UTC] jani@php.net
-Operating System: Windows XP Professional SP3 +Operating System: win32 only
 [2013-10-24 08:11 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2013-10-24 08:11 UTC] yohgaki@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 24 00:03:50 2022 UTC