ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#44954 [Opn->Fbk]: file_get_contents crashes Apache
by jani other posts by this author
May 9 2008 7:12AM messages near this date
#44954 [Fbk->Opn]: file_get_contents crashes Apache | [PHP-DEV] Extention_Dir
ID:               44954
 Updated by:       jani@[...].net
 Reported By:      abakker at gmx dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: Win XP
 PHP Version:      5.2.6
 New Comment:

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.





Previous Comments:
------------------------------------------------------------------------

[2008-05-09 11:22:01] abakker at gmx dot net

Description:
------------
Apache crashes if a lot of file_get_contents are done. The Apache
error.log only contains this (I guess this just confirms that the Apache
server has crashed and no longer responds): [Fri May 09 12:15:04 2008]
[error] [client 192.168.0.1] PHP Warning: 
file_get_contents(http://localhost/test.htm) [<a
href='function.file-get-contents'> function.file-get-contents</a>]:
failed to open stream: A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond.\r\n in
C:\\Andre\\Apache\\test.php on line 6


Reproduce code:
---------------
The following PHP script reproduces the problem:

<?php
echo '<pre> ';
for ($i=1;;$i++)
{ echo $i."\n";
  flush();ob_flush();
  $contents = file_get_contents('http://localhost/test.htm');
}
?> 

After 203 iterations the Apache server crashes. The result is the same
whether localhost or IP address is used.

The problem depends on the contents of the test.htm file. If it only
contains

<html> 
<body> 
</body> 
</html> 

the script runs until it reaches the max execution time.

The test.htm that reproduces the problem contains:

<html> 
<head> 
<link rel="stylesheet" href="/systeem/style/style.css"> 
<title> V.V. De Meern</title>
<meta name="description" content="V.V. De Meern"> 
<meta name="robots" content="index,follow"> 
<script src="/beheer/include/header.js"> </script>
</head> 
<body> 
<script src="menu.js"> </script>
<a href="menu.html"> </a>
<h1> Home pagina A1</h1>
<p> <img src="a1.jpg" border="0" alt="" /></p>
<h1> Spelers</h1>
<p> Nicky Vermeulen, Jon Gruters, Jerryl Smeenk, Bram van Wiggen, Rolf
van
Elderen, Sander van der Woude, Melvin van Nood, Jorgos Katsivilis, Leo
Wakelkamp, Chen Margolin, Luis Plein, Danny Berkhouwer, Whaheed
Khodabaks,
Alessandro Damen, Thomas van Amerongen</p> 
<h1> Leiders</h1>
<p> John Dunsbergen, Joost Satink, Lex van der Woude</p>
<script src="/beheer/include/footer.js"> </script>
</body> 
</html> 

Expected result:
----------------
Run until max execution time exceeded.

Actual result:
--------------
Crashed beforehand.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44954&edit=1
Thread:
Abakker At Gmx Dot Net
Abakker At Gmx Dot Net
jani
Abakker At Gmx Dot Net
jani
jani
Abakker At Gmx Dot Net
jani

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved