Edit report at https://bugs.php.net/bug.php?id=55151&edit=1
ID: 55151 Updated by: johan...@php.net Reported by: dkettmann at kmcis dot com Summary: Unable to open sessions while MySQL DB connection is open -Status: Open +Status: Bogus Type: Bug Package: Session related Operating System: RHEL/CentOS PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php If you do a session_start() the session file is locked till the session is closed again. This is needed to avoid loosing data from concurrent requests. In your example: If 2.php would change the session data this would be overwritten by the old state in 1.php. Previous Comments: ------------------------------------------------------------------------ [2011-07-06 14:34:32] dkettmann at kmcis dot com Description: ------------ On RHEL(or Centos) 5.6 running any available PHP package thru RedHat and the latest version of PHP (5.3.6). Run first script provided in a browser, then while that is running, fire up the second script. The second script will not finish until the first one calls the session_write_close() function. Test script: --------------- === 1.php === <?php $counter=1; $DB= mysql_connect(localhost,$user,$pass,true); mysql_select_db("database"); session_start(); echo "Starting...\n"; while ( $counter <= 5 ) { echo "$counter ... \n"; sleep(2); $counter++; } echo "Done!... \n"; session_write_close(); ?> === 2.php === <?php session_start(); echo "TESTING!\n"; session_write_close(); ?> Expected result: ---------------- When both scripts are run at the same time, the second script should exit (nearly) immediately after opening a session, echoing the TESTING line, then closing the session. After the while loop is done in the first script, it should exit as expected. Actual result: -------------- When the both scripts are executed at the same time (or one right after the other), the second script hangs at the 'session_start()' line until the first script is done. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55151&edit=1