|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-03 17:55 UTC] iberry at raxnet dot net
I think I have found some sort of race-like condition using session_start() and popen() functions, causing the web server to hang. The bug only seems to manifest when repeatedly initiating a page that requires session_start() and uses popen(). This is relevant for me because this page renders graphs and needs both of these functions to perform its job. Here is some example code to re-produce the problem:
----test.php----
<img src="img.php?rra_id=1">
<img src="img.php?rra_id=2">
<img src="img.php?rra_id=3">
<img src="img.php?rra_id=4">
----end----
----img.php----
<?php
session_start();
$fp = popen('test', "r");
print fpassthru($fp);
pclose($fp);
?>
----end----
Notice how I am passing different GET variables to each image page session, this seems to be necessary for the bug to manifest. This code has been tested on both IIS 5 and Apache 2.0.44 with the same results
The path I give popen() does not appear to make a difference. I have also have tried the popen 'r' and 'rb' file modes, which made no difference. The two triggers of this bug appear to be the combined use of session_start()/popen() and the varying GET variable values.
Thanks for taking time to look into this.
-Ian
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
Hi, I have written already about apache hanging, in bug number 28856. I think that the problem is not only session related, and that it appeared after PHP 4.3.2. You may not agree with the fact that including, requiring or "virtual"ing pages that are on the same server need to be included using the full http domain name. But there, we do it a lot, and it's working very well on our old servers, with php 4.3.2. Here is a very simple example where the server is hanging. file1.php : <? include("http://thisdomain.com/file2.php"); ?> file2.php : <? //anything, for example phpinfo(); ?> On a Debian Box, PHP Version 5.0.1-dotdeb, Apache/1.3.26, the server is hanging . No session started, session.auto_start set to Off. I agree that this is a stupid example and that here I would use simply include("file2.php"); believe me the situations where we use the include("http ...) are a lot more complex and we cannot avoid to do this. Please, don't answer that nobody uses the include, or require, or anthing, with the http to be able to use some Apache Vhost related features : we do a lot, and I am in a despair, here ... Thanks for your attention, Estellepubnelle is right. I tried this: ----file1.php---- <? include("http://www.infogateway.org/file2.php?foo=test"); ?> ----end---- ----file2.php---- <? echo $_GET['foo']; ?> ----end---- And it crashes! Don't go tell us it is not a bug or problem, the php manual says it should work: ---- If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix L for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script. ---- -JaccoI've experience what appears to be the same bug when using file("http://blah") to retrieve the contents of a particular URL. The workaround suggested does do the job. FWIW, I'm on Linux, not Win2K, using Apache 1.x SAPI. Has this bug been fixed properly (i.e., not just the workaround suggested)? And if so, in which release?