Home » Php » PHP serving one page at a time

PHP serving one page at a time

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m running an Apache 2 and PHP 5.2 configuration, and for some reason, PHP can only serve one page at a time.

I have two pages which best illustrate the problem: test1.php and test2.php.

test1.php only has sleep(120) in it, test2.php has a simple ‘print “hello world”;’ in it.

If test1.php is currently loading in a browser window, an attempt to load test2.php hangs until test1.php has completed.

Can anyone help? This is driving me absolutely insane.

How to&Answers:

Are you doing session_start() in each of them? If so, there’s your answer. For long-running processes you will want to end the session as soon as you can because a session_start() locks the session until you do a session_commit() or that implicitly happens by the page finishing.