简体   繁体   English

Windows和php-fpm上的Apache

[英]Apache on windows and php-fpm


php 7.1 PHP 7.1
Apache 2.4 + mod_proxy_fcgi Apache 2.4 + mod_proxy_fcgi
Windows 10 Windows 10

I'm trying to set up php-fpm + apache on windows, using mod_proxy_fcgi but keep getting errors. 我正在尝试使用mod_proxy_fcgi在Windows上设置php-fpm + apache,但仍会出现错误。 Can anyone help me with configuring apache. 谁能帮我配置apache。

I got php-fpm runnig, and verified that it actually works using nginx, so php should not be a problem. 我得到了php-fpm runnig,并验证了它实际上可以使用nginx正常工作,因此php应该不是问题。


PHP-fpm is running on port 9123. PHP-fpm在端口9123上运行。

Here is my vhost config: 这是我的虚拟主机配置:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "${SRVROOT}/htdocs"
    <Directory "${SRVROOT}/htdocs">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        <FilesMatch "\.php$">
            SetHandler proxy:fcgi://127.0.0.1:9123
        </FilesMatch>
    </Directory>    
</VirtualHost>

Here is the error: 这是错误:

Proxy Error 代理错误

Your browser sent a request that this server could not understand. 您的浏览器发送了该服务器无法理解的请求。 The proxy server could not handle the request GET /index.php/. 代理服务器无法处理请求GET /index.php/。

Reason: URI cannot be parsed: fcgi://127.0.0.1:9123C:/Apache24/htdocs/index.php* 原因:无法解析URI:fcgi://127.0.0.1:9123C:/Apache24/htdocs/index.php*

Does anyone know how to fix it ? 有谁知道如何修理它 ?

I was dealing with the same issue and I found the root cause: most likely we were both following the this wiki.apache.org guide . 我正在处理同一问题,并且找到了根本原因:最有可能我们俩都遵循了wiki.apache.org指南 There are a couple of typos in said guide. 所述指南中有一些错别字。 What causes the problem for us is that there is a missing slash after SetHandler . 对我们造成问题的是SetHandler之后缺少斜杠。 This is the config that worked for me: 这是为我工作的配置:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

<FilesMatch "\.php$">
    <If "-f %{REQUEST_FILENAME}">
        SetHandler "proxy:fcgi://localhost:9123/"
    </If>
</FilesMatch>

have you tried putting the: 您是否尝试过放置:

<FilesMatch "\.php$">
    SetHandler proxy:fcgi://127.0.0.1:9123
</FilesMatch>

outside the directory? 目录外? Ie. 就是 what happens if you put that part between the docroot directive and the directory directive? 如果将该部分放在docroot指令和目录指令之间,会发生什么情况?

Regards, Eric 问候,埃里克

Hi try something like : 嗨,尝试一些类似的东西:

<FilesMatch "^/CHANGE_ME/.*\.php(/.*)?$">
    SetHandler proxy:fcgi://127.0.0.1:9123
</FilesMatch>

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

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