php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20759 fopen sometimes hangs
Submitted: 2002-12-02 04:21 UTC Modified: 2002-12-15 04:06 UTC
From: mitra_php at mitra dot biz Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID: None
 [2002-12-02 04:21 UTC] mitra_php at mitra dot biz
Sometimes fopen of an http URL just sits there - no error, no results, typically when it does this PHP refuses to output ANY output for that page. 

FOr example fopen("http://anyurl.com","r") works fine but

fopen("http://reptile.peerfear.org/reptile/servlet/sitefilter/http/www.cnn.com/WORLD","r") 

Just sits there for ever. 

Its possible that reptile is misbehaving, although this URL works fine in a browser, and in any case fopen shouldn't just sit there.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-02 04:24 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

In PHP 4.3, there is a new ini setting which allows setting a default timeout.
Please try PHP-4.3.0RC2 from http://qa.php.net.
Be sure to read the NEWS file for info about the timeout option. (the default is 60 seconds).
 [2002-12-02 05:07 UTC] mitra_php at mitra dot biz
Thanks for the suggestion, but the PHP timeout isn't the problem - its fopen that is hanging. It should fail allowing the script to handle the error gracefully (in my case moving on to the next URL). The PHP timeout only fails the whole PHP script if nothing happens in 60 seconds.
 [2002-12-02 05:09 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Try the PHP 4.3.0RC2 and check php.ini-dist, you will find this:

; Default timeout for socket based streams (seconds)
default_socket_timeout = 60


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 16 05:01:25 2019 UTC