andkrau / WIN-FPM

Implements a PHP FastCGI Pool Manager on Windows
The Unlicense
2 stars 0 forks source link

How to call from web server #1

Closed pwhodges closed 3 years ago

pwhodges commented 4 years ago

I have been looking for something like this, and am delighted to have found it - but haven't been able to see how to use it. Specifically, how is it called from the web server? I'm hoping that it can simply be called using a fastcgi call to a single port, but I don't know enough of tcl to work out whether that is what's actually being set up.

My webserver is Caddy, and its command to proxy php requests to fastcgi is of the very simple form:

php_fastcgi 127.0.0.1:9000

I am using it to contact a copy of php-cgi running as a service listening on that port.

Thanks for any hints!

Paul

andkrau commented 3 years ago

Sorry for the extremely late reply @pwhodges !

The current version relies on the web server directly communicating with each PHP pool instead of routing the data through WIN-FPM. The v2.0.0 release works with PHP 7.0 and above (finally built a binary). The previous release was only really meant for very old releases of PHP.

For the example in the readme: win-fpm.exe -basePort 9001 -poolSize 8 -phpDir C:/php -fcgiChildren 2 -listenHost 127.0.0.1 -errorLimit 10

The example Caddy 1.0 caddyfile would be:

fastcgi / 127.0.0.1:9001 php {
    upstream 127.0.0.1:9002
    upstream 127.0.0.1:9003
    upstream 127.0.0.1:9004
    upstream 127.0.0.1:9005
    upstream 127.0.0.1:9006
    upstream 127.0.0.1:9007
    upstream 127.0.0.1:9008
}

To run PHP on a single port (as in your caddyfile example) you would use this command line: win-fpm.exe -basePort 9000 -poolSize 1 -phpDir C:/php -fcgiChildren 8 -listenHost 127.0.0.1 -errorLimit 10

With a pool size of 1, you won't really gain any performance by having WIN-FPM start the PHP process. At most, it would be a little more convenient than manually configuring things.