如何在WAMP上运行多个.PHP脚本同一时间?

时间:2013-03-16 14:04:05

标签: php nginx wamp

我正在尝试同时运行多个PHP脚本文件(在Chrome浏览器中),但似乎WAMP限制了最大值8.应该允许超过8的正确设置是什么? 是否可以像在NGINX中那样运行httpd.exe实例的多个worker?

4 个答案:

答案 0 :(得分:0)

我认为你必须在apache配置中更改maxclients。你的配置必须有这样的东西:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers        5
    MinSpareServers     5
    MaxSpareServers     10
    MaxClients          150
    MaxRequestsPerChild 0
</IfModule>

有关详细信息,请查看此内容:http://fuscata.com/kb/set-maxclients-apache-prefork

答案 1 :(得分:0)

您遇到的问题可能与服务器无关,而与浏览器无关。浏览器只允许有限数量的同时连接到某个服务器,因此如果您想要克服该限制,则必须使用不同的服务器。

您可以在主机文件中执行此操作,例如使用不同的名称路由到同一主机(为清晰起见,在不同的行上):

127.0.0.1 server1.local
127.0.0.1 server2.local
127.0.0.1 server3.local
127.0.0.1 server4.local
etc.

现在你可以拥有8个(我认为它是6个用于Chrome)与server1.local,8到server2.local等的连接。

修改:有关详细信息,请参阅this question

答案 2 :(得分:0)

转到:

<xampp_root>/xamppfiles/etc/httpd.conf

确认以下内容未被注释:

# Server-pool management (MPM specific)
#Include <xampp_root>/etc/extra/httpd-mpm.conf

(显然请留下评论本身注释并取消注释下面的行)。

然后转到:

<xampp_root>/etc/extra/httpd-mpm.conf

并确认该行的值是否为

MaxClients          150

高于8。

答案 3 :(得分:0)

根据这个advise,如果你想增加每个 SINGLE 用户的并发执行量,你应该关闭:

session.auto_start

(您可以通过 phpinfo() 检查是否已打开)

或内部脚本(如果会话是独立启动的,例如:

session_start();
// do stuff, read vars etc...
session_write_close();

// do something that takes a long time....


session_start();
// now update sesson vars with the result