php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16881 fopen sometimes hangs
Submitted: 2002-04-27 16:11 UTC Modified: 2002-04-27 18:33 UTC
From: jandevries146 at noknok dot nl Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.2.0 OS: windows ME with apache
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jandevries146 at noknok dot nl
New email:
PHP Version: OS:

 

 [2002-04-27 16:11 UTC] jandevries146 at noknok dot nl
I want to automaticly save some webpages.
To do this i use a loop which requests the data. 
About 9 out of 10 times it goes without problems, but
sometimes the script hangs at the line with 
fopen($link,"rb"); 
saying : Maximum execution time of 30 seconds exceeded in ........

for ($i=0;$i<25;$i++)
   {
      $link = someURL;
      $fp=fopen($link,"rb");
   }

 I also tried without any results:
  -sleep(1);
  -fclose($fp);
  -fopen($link,"r"); // this is "r" instead of "rb"
  -installing everything again on a new windows

If i then run the same program again i dont get any 
problems. I know for sure the URL i open are available,
but even when they are not available it should give a warning and not hang.

If you want to reproduce the error just open 300 links with fopen under windows.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-27 18:33 UTC] mfischer@php.net
fopen() is simply not suited for this task as it cannot be configured. Use fsockopen() and socket_set_timeout() or use the socket_*() interface directly.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 01 18:00:01 2025 UTC