php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44009 fopen hangs with recent upgrade
Submitted: 2008-02-01 00:34 UTC Modified: 2008-02-15 16:49 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: brandonkahre at charter dot net Assigned:
Status: Closed Package: HTTP related
PHP Version: 5.2.5 OS: Windows
Private report: No CVE-ID:
 [2008-02-01 00:34 UTC] brandonkahre at charter dot net
Description:
------------
When opening a file using fopen and a network wrapper (HTTP), the page will lag before finishing.  The response from fopen is fast (determined by echo'ing the return, and any code that is to be processed after the fopen function is processed without delay.  It is only when the page is ready to finish loading that the lag becomes noticeable.  The lag takes 3-6 seconds and does not seem to be affected by any timeout settings in the php.ini file.
This problem does not exist in PHP 5.1.2, and started immediately after upgrading to PHP 5.2.4 and 5.2.5.  This problem also seems to only exist on my Windows server.

Reproduce code:
---------------
<?php
	echo (file_get_contents("http://www.google.com"));
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-14 18:09 UTC] brandonkahre at charter dot net
Thank you for the response.

I have upgraded my server using the latest PHP build and I have found that the test script above runs quickly, but only when using the recommended-ini configuration.  I have compared my existing configuration to the recommended configuration and I have found that the problem lies with the "extension_dir" directive.  My existing configuration (experiencing the bug) uses:
extension_dir = "C:\Program Files\PHP\ext"

The recommended configuration uses:
extension_dir = "./"

Prior to PHP 5.2.X (tested with 5.1.2), I did not experience this bug, but making this simple change to PHP 5.2.X fixes the bug.
 [2008-02-14 18:26 UTC] brandonkahre at charter dot net
A correction to the post above:

It is not the "extension_dir" directive causing problems, but actually the extensions themselves.  If I change the directive to what was listed initially, but disable all of the extensions, the scripts execute quickly.  However, once a single extension is loaded (eg. php_mysql.dll or php_mysqli.dll), the script hangs as stated previously.
 [2008-02-14 22:54 UTC] jani@php.net
Let me guess: there's an error in some log with this in it 'my_thread_global_end' ?? (Try search for that in the bug db too..)

 [2008-02-15 16:49 UTC] brandonkahre at charter dot net
You are, of course, correct.  It looks like this has been a long outstanding bug.  After digging through a very long (and seemingly unresolved) bug ticket, I was able to use the mysql and mysqli extensions from PHP 5.1.2 with the 5.2.X branch and have no problems.  I will mark this ticket resolved since it overlaps bug #41350.

http://bugs.php.net/bug.php?id=41350
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 19:01:51 2014 UTC