windows-7 - Windows PHP-FPM 可以同时处理多个请求吗?

标签 windows-7 nginx php

我目前正在使用 nginx PHP FastCGI 但这种安排受到限制,即一次只能服务一个 HTTP 请求。 (参见 here。)我从 Windows 命令提示符启动 PHP:

c:\Program Files\PHP>php-cgi -b 127.0.0.1:9000

然而,还有另一种运行 PHP 的方法,称为“Fast CGI Process Manager”(PHP-FPM)。

在 nginx 后面的 Windows 7 上运行时,PHP-FPM 可以同时处理多个 HTTP 请求吗?

最佳答案

还有一种替代方法,以更好的方式。

在 nginx 配置中使用简单的 Fast-CGI 设置

nginx.conf

server {
     ....
     location ~ \.php$ {
            try_files   $uri =404; 
            include     fastcgi.conf;
            fastcgi_pass    127.0.0.1:9001;
            fastcgi_read_timeout 60;
            allow       127.0.0.1;
            allow       ::1;        
            deny        all;        
       }
  }

然后在你的 start.bat 文件中
set PATH=%cd%\bin\php;%PATH%
set PHP_FCGI_MAX_REQUESTS=0
set PHP_FCGI_CHILDREN=10
RunHiddenConsole.exe %cd%/php/php-cgi.exe -b 127.0.0.1:9001 -c %cd%/php/php.ini

PHP_FCGI_CHILDREN 变量是魔法发生的地方。 PHP_FCGI_MAX_REQUESTS 也很重要。

关于windows-7 - Windows PHP-FPM 可以同时处理多个请求吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15819351/

相关文章:

php - yii2 插入数据库

php - 为什么我的图像文件无法用 PHP 上传?

c# - 延迟关机和锁屏

encryption - 为什么有 "Computer\Personal\Certificates"商店和 "Current User\Personal\Certificates"

php - 如何正确设置数据卷容器?

缓存 404s - NGINX 还是 Varnish ?

php - 如何为 Facebook 刷新/修改 Meta?

powershell - 如何在powershell v2中正确转义引号?

c++ - 如何确定加载我的 DLL 的 DLL 名称(字符串)?

django LOGIN_REDIRECT_URL 在 nginx ssl 后面不工作