Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: How to use external (2nd server) PHP-FPM with Apache on Win |
|
Author |
|
Zane_TLI
Joined: 28 May 2017 Posts: 11 Location: Ferrara, Italy
|
Posted: Sun 11 Jun '17 9:40 Post subject: How to use external (2nd server) PHP-FPM with Apache on Win |
|
|
I'm trying to configure Apache on a Windows PC to use PHP-FPM via TCP. PHP-FPM itself runs on a different host, so James Blond guide doesn't apply.
Since multiple vhosts will be running on the first PC, I strongly would prefer to configure a default in httpd.conf.
I started from here: High-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpm.
On the 2nd server, PHP-FPM is running as:
Code: | "%ProgramFiles%\PHP\php-cgi.exe" -b 192.168.0.2:9123 -c "%ProgramFiles%\PHP\php.ini" |
On the 1st server, Apache httpd.conf:
Code: |
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://192.168.0.2:9123/"
</If>
</FilesMatch>
|
With this setup, Apache spits:
Quote: | No input file specified. |
This looks PHP-FPM to me, so I think that the only issue here is that PHP-FPM is not receiving the script to run.
Any hints? please note that I'm in no way bound to the "mod_proxy" approach: mod_fcgid, mod_fastcgi or anything else are OK as long as I can specifiy a TCP socket as PHP-FPM target.
Thansk! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7375 Location: Germany, Next to Hamburg
|
Posted: Mon 12 Jun '17 11:46 Post subject: |
|
|
my FPM test on Windows was
Code: | <VirtualHost *:80>
ServerName fpm.local.apachehaus.de
DirectoryIndex index.php
CustomLog "C:\nul" common
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/c:/Users/james/work/$1
DirectoryIndex /index.php index.php
DocumentRoot "/Users/james/work"
<Directory "/Users/james/work">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> |
also tried
Code: | <IfModule proxy_fcgi_module>
# Enable http authorization headers
<IfModule setenvif_module>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
ProxyPassMatch ^(.*\.php(.*)?)$ fcgi://127.0.0.1:9000/c:/Users/james/work/$1
</IfModule> |
But I never got is running on windows while it wasn't a problem on linux. |
|
Back to top |
|
|
|
|
|
|