From: Operating system: Windows XP Professional SP3 PHP version: 5.2.13 Package: CGI related Bug Type: Bug Bug description:CLI script + Sockets + Windows causes hang/pause at end of script execution
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. -- Edit bug report at http://bugs.php.net/bug.php?id=51271&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51271&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51271&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51271&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51271&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51271&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51271&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51271&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51271&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51271&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51271&r=support Expected behavior: http://bugs.php.net/fix.php?id=51271&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51271&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51271&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51271&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51271&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51271&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51271&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51271&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51271&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51271&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51271&r=mysqlcfg