简体   繁体   English

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

[英]How Can I Run Multiple .PHP Scripts Same Time On WAMP?

I am trying to run multiple PHP script files same time (in chrome browser) but it seems like WAMP is limiting on maximum 8. What should be the correct settings to allow more than 8 ?我正在尝试同时运行多个 PHP 脚本文件(在 chrome 浏览器中),但似乎 WAMP 限制为最多 8 个。允许超过 8 个的正确设置应该是什么? Is it possible to run multiple workers of the httpd.exe instance like in NGINX ?是否可以像在 NGINX 中一样运行 httpd.exe 实例的多个工作程序?

I think you must change maxclients in apache configs.我认为您必须在 apache 配置中更改maxclients You configs must have something like this:你的配置必须是这样的:

# 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>

for more information have a look at this: http://fuscata.com/kb/set-maxclients-apache-prefork有关更多信息,请查看: http : //fuscata.com/kb/set-maxclients-apache-prefork

The problem you are running into is probably not related to the server, but to the browser.您遇到的问题可能与服务器无关,而与浏览器有关。 Browsers only allow a limited number of simultaneous connections to a certain server, so if you want to overcome that limit, you would have to use different servers.浏览器只允许有限数量的同时连接到某个服务器,所以如果你想克服这个限制,你将不得不使用不同的服务器。

You could do that in your hosts file, using different names to route to the same host, for example (on different lines for clarity):例如,您可以在 hosts 文件中执行此操作,使用不同的名称路由到同一主机(为清楚起见,在不同的行中):

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.

Now you can have 8 (I thought it was 6 for Chrome) connections to server1.local , 8 to server2.local , etc.现在你可以有 8 个(我认为 Chrome 是 6 个)到server1.local连接,8 个到server2.local等等。

Edit: See this question for more information.编辑:有关更多信息,请参阅此问题

Go to :去 :

<xampp_root>/xamppfiles/etc/httpd.conf

And confirm that the following is uncommented:并确认以下未注释:

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

(Obviously leave the comment itself commented and uncomment the line below). (显然,将评论本身留下评论并取消注释下面的行)。

Then go to:然后去:

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

And confirm if the value for the line:并确认该行的值:

MaxClients          150

Is above 8.大于 8。

Per this advise , if you want to increase the concurrent amount of execution per SINGLE user, you should turn of:根据这个建议,如果你想增加每个 SINGLE 用户的并发执行量,你应该关闭:

session.auto_start

(you can check with phpinfo() if it's turned on or not) (您可以使用phpinfo()检查它是否已打开)

or inside script (if session was started independently,like:或内部脚本(如果会话是独立启动的,例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM