【问题标题】:How Can I Run Multiple .PHP Scripts Same Time On WAMP?如何在 WAMP 上同时运行多个 .PHP 脚本?
【发布时间】:2013-03-05 05:15:35
【问题描述】:

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

【问题讨论】:

  • 多个脚本文件是什么意思?请解释清楚
  • 8 个不同的 php 文件,具有多个循环(执行时间......千秒)同时运行

标签: php nginx wamp


【解决方案1】:

我认为您必须在 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

【讨论】:

    【解决方案2】:

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

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

    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 个(我以为 Chrome 是 6 个)连接到 server1.local、8 个到 server2.local 等。

    编辑:更多信息请参见this question

    【讨论】:

      【解决方案3】:

      转到:

      <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 以上。

      【讨论】:

      • 我拥有并拥有 Mostafa Shahverdy 提供的设置,但确实评论了 #Include /etc/extra/httpd-mpm.conf...
      【解决方案4】:

      根据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
      

      【讨论】:

        猜你喜欢
        • 2017-05-08
        • 2016-11-14
        • 1970-01-01
        • 2017-06-23
        • 1970-01-01
        • 1970-01-01
        • 2018-06-06
        • 2020-02-19
        • 2016-03-07
        相关资源
        最近更新 更多