PHP一次提供一页

时间:2020-12-17 01:14:07

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

我正在运行Apache 2和PHP 5.2配置,由于某种原因,PHP一次只能提供一个页面。

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

我有两个页面最能说明问题:test1.php和test2.php。

test1.php only has sleep(120) in it, test2.php has a simple 'print "hello world";' in it.

test1.php只有sleep(120),test2.php有一个简单的'print'hello world“;'在里面。

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

如果test1.php当前正在浏览器窗口中加载,则尝试加载test2.php会挂起,直到test1.php完成。

Can anyone help? This is driving me absolutely insane.

有人可以帮忙吗?这让我非常疯狂。

1 个解决方案

#1


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.

你在每个人都在做session_start()吗?如果是这样,那就是你的答案。对于长时间运行的进程,您将希望尽快结束会话,因为session_start()会锁定会话,直到您执行session_commit()或页面完成时隐式发生。

#1


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.

你在每个人都在做session_start()吗?如果是这样,那就是你的答案。对于长时间运行的进程,您将希望尽快结束会话,因为session_start()会锁定会话,直到您执行session_commit()或页面完成时隐式发生。