|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-03-11 10:48 UTC] didier dot alain at laposte dot net
<?php $url = "http://test/block.html?PHPSESSID=".session_id(); $fp = fopen($url, 'r'); // the file pointer semms to be valid $file = fread($fp,1048576); //hangs here ! echo $file; ?> hangs apache (1.3.x). Same with 4.0.2, 4.0.6 Linux (RH 6.2 and Debian 2.2), never on Win98. Other parameters don't have the same effect. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
Sorry for the long time... Here's a complete but simple example : ------------- In httpd.conf ------------- <Directory "/var/www/docs/"> php_value auto_prepend_file "block.php" </Directory> (block.php is in my php.ini include_path, and /var/www is my Apache DocumentRoot) ------------ open_doc.php (<--I call this one with my browser) ------------ <?php session_register("s_util"); $s_util = toto"; session_start(); echo "Session Id :".session_id(); //just to be sure... $doc = "http://http://myserver/docs/mydoc.html?PHPSESSID=".session_id(); readfile($doc); //same with $fp=fopen($doc, "r"); ?> --------- block.php --------- <?php session_start(); echo "Session Id :".session_id(); //just to be sure... if (session_is_registered("s_util")) { echo "Right, man !"; } else { echo "No auth!"; } ?> I can't see any infinite loop here, but I may be wrong... Whenever you don't pass the session param in the url anymore, there's "no problem" anymore, except you can't retrieve session values !The mentioned problem is probably caused because PHP opens the session file in a exclusive, which denies other threads to open the same file. // Starts session and opens session file in exclusive mode session_start(); // And here is the important thing. You need to close the session file, before calling in second thread, which will access the same session file. session_write_close(); // read http page into string $html = implode("", file("http://localhost/backend.php?".session_name()."=".session_id()."&SESSION_NAME=".session_name()); // Start again the session session_start();