一次只能运行一个PHP脚本吗? [英] Can only one PHP script run at a time?

查看:133
本文介绍了一次只能运行一个PHP脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在运行的PHP脚本,正在我的计算机上进行测试(正在运行WampServer),我注意到它正在运行时,该网站的其余部分将不会加载(浏览器仅显示加载图标)

I have a long-running PHP script that I'm testing on my computer (running WampServer) and I've noticed that while it's running, the rest of the site will not load (the browser just shows the loading icon).

一次只能运行一个PHP脚本吗?如果是这样,是否意味着如果我网站上的脚本需要30秒钟才能运行,在此期间没有人能够使用该网站?

Can only one PHP script run at a time? If so, does mean if a script on my website takes 30 seconds to run, no one will be able to use the site during that time?

更多信息:

正在执行长时间运行的脚本时,几乎没有使用CPU或内存.

While the long-running script is executing, almost no CPU or memory is used.

推荐答案

如果您在Apache/PHP conf中使用文件系统作为会话存储,则限于每个会话运行一个脚本.

If you in your Apache/PHP conf use filesystem as the store for sessions you're limited to one script running per session.

尝试以隐身模式打开您的网站,您应该可以正常浏览它.这是因为您随后开始另一个会话.

Try opening your site in incognito mode and you should be able to browse it as normal. This because you then start another session.

还要检查Apache工人的数量.如果将其设置为1,则您一次只能运行1个.我认为默认值应该更高.

Also check the number of Apache workers. If that's set to one you will only be able to run one at the time. I think the default should be higher.

这篇关于一次只能运行一个PHP脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆