The PHP-FPM's homepage http://php-fpm.org/ states that it is part of PHP since PHP 5.3.3. Now, I was wondering, when I download the newest PHP binaries from php.net, there is no php-fpm in it. How do I get it? Is it even available for Windows?
7 Answers
Here how to setup php-fpm on Windows:
Download the .zip file from http://windows.php.net/download/. The .zip file should be VC9 which has the FastCGI file (php-cgi.exe). Don't download VC6, and don't download the .msi file because it requires that you have IIS setup already in order to install php-fpm. The zip file contains the php-cgi.exe which is what you need for php-fpm. I downloaded a slightly older version, php-5.3.10-Win32-VC9-x86.zip, from here http://windows.php.net/downloads/releases/archives/ because I wanted to match the version running on my production server.
Unzip the file, e.g. unzip into C:\php-5.3.10-Win32-VC9-x86
Edit the php.ini file as needed. What I did:
# nginx security setting cgi.fix_pathinfo=0 extension_dir = "C:\php-5.3.10-Win32-VC9-x86\ext"
enable the following modules by uncommenting them:
extension=php_curl.dll extension=php_mbstring.dll extension=php_mysqli.dll
Create a .bat file somewhere, e.g. start-php-fcgi.bat in webserver directory or in the PHP directory:
@ECHO OFF ECHO Starting PHP FastCGI... set PATH=C:\php-5.3.10-Win32-VC9-x86;%PATH% C:\php-5.3.10-Win32-VC9-x86\php-cgi.exe -b 127.0.0.1:9123 -c C:\php-5.3.10-Win32-VC9-x86\php.ini
Double click the .bat file to start php-fpm. A window will popup and stay open while its running. Its kind of annoying, but just haven't looked into setting it up as service yet.
Configure your webserver. If you wish to use it with nginx, here a config sample for 127.0.0.1:9123:
location ~ \.php$ { fastcgi_pass 127.0.0.1:9123; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
-
Useful information getting it up and running, any experience in using it with Apache and mod_proxy_fcgi – Mister Dai Jun 20 '12 at 15:01
-
52but that's not php-fpm, it's fastcgi – Jürgen Paul Jul 01 '12 at 04:25
-
19php-fpm = php-Fastcgi Process Manager – Alan Jul 02 '12 at 14:10
-
2Sorry Mister Dai, I have not tried using it with Apache. Once I learned about and started using NGINX, I haven't used Apache anymore. – Alan Jul 02 '12 at 14:13
-
8The guide is useful, though Severus was right. In this case, the process manager is the batch file that starts and kills a single fastcgi process. The actual php-fpm is much more versatile and comes with a 300-lines config file. – sayap Aug 28 '12 at 13:04
-
4@Alan Yes, but this answer is merely a process starter. There is no multi-threading or other support for concurrent requests. – Sleavely Aug 26 '13 at 13:17
-
2php-cgi.exe is a fastcgi server not the fastcgi process manager. It just spawns fcgi processes. – Sebi2020 Feb 12 '19 at 07:16
-
People are missing the point. PHP-FPM is just an SAPI that manages a pool of FCGI processors. php-cgi is designed to do the same thing. While the implementations have obvious differences, they both solve the same problem, and they both are production quality. "It just spawns fcgi processes" shows how short sighted people are being on this. – JSON Aug 05 '22 at 03:36
Old as this post is I have to weigh in here because what has been posted here is not PHP-FPM, it's running PHP using Fast-CGI.
Yes PHP-FPM stands for PHP-FastCGI Process Manager and so implements FastCGI but you are forgetting that FPM is much more than that as it contains process management features that are not managed by the webserver.
On *nix systems PHP-FPM has a separate process that manages the PHP child processes and has a detailed configuration to specify how these processes are managed. For details on these features read here
Launching a CGI process on windows is not the same thing. It does not spaw worker processes or dynamically scale them or allow multi-threading.
There is no PHP-FPM for windows yet. http://php.net/manual/en/install.fpm.php#121725
However as suggested, you may launch a CGI process if you wish.

- 629
- 5
- 5
Alan's answer is a great start. However, for Apache 2.4 and later you do not need to run PHP-FPM as a separate service, you can use mod_fcgid to handle everything within Apache.
Here is an example configuration:
LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PHPRC "c:/php"
FcgidInitialEnv PATH "c:/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 500
<Files ~ "\.php$">
AddHandler fcgid-script .php
FcgidWrapper c:/php/php-cgi.exe .php
</Files>
Note, this is based on a post in Apache Lounge. As helpful as it was, their version had quotes around c:/php/php-cgi.exe and if you do that it WILL NOT START php-cgi.exe, at least on Windows Server 2012, and you get HTTP 500. Took me a painful few days to figure that out.

- 3,137
- 26
- 36
-
Dear Erica, THANK YOU for isolating the problem for me! I had been struggling with this for several weeks (albeit intermittently). – Theodore R. Smith Sep 01 '14 at 02:25
-
-
5That’s not an answer to the question. The question was if and where fpm is on Windows. You provided an *alternative* approach to using fpm. – Kissaki May 04 '15 at 20:58
-
1An approach which will work for many Windows users, and an answer that has helped others as you see above...seriously, you needed to downvote this? – Erica Kane May 04 '15 at 22:40
-
1I did not have any issues with quotes around `php-cgi.exe` running Apache 2.4.16. Like in the post referenced, I suspect this issue affected older versions of Apache. Granted, I'm using a Server 2008, and not Server 2012. – Jake Z Aug 19 '15 at 15:58
-
He asked for a solution for windows. LoadModule fcgid_module modules/mod_fcgid.so is linux. – Sebi2020 Feb 12 '19 at 07:18
-
No @Sebi2020, my solution was on Windows and it ran perfectly. Please fix your vote. – Erica Kane Feb 12 '19 at 11:54
-
@EricaKane I have never voted on your answer. There is nothing to fix. But sorry, I was wrong. – Sebi2020 Feb 13 '19 at 00:55
-
-
1This is a valid answer to the question. If your engine stops and you think it needs a new flux capacitor, it's a valid answer for one to say "those aren't available for your model, but this coil pack will get her going" – JSON Aug 05 '22 at 04:03
Starting PHP v5.3.3, FPM Server-API [SAPI] support has been integrated into core PHP. This means, you can take PHP's source codes and compile and build them with FPM-SAPI [using --enable-fpm
configuration parameter] support, instead of let's say Apache SAPI [--enable-apx2
]. As shown in PHP-Wiki you can build PHP almost the same way you do in *nix systems - that is, configuration-wise. I would suggest you learn the ins and outs of building PHP in *nix systems first, and even try to do it yourself [usual configure
, make
and make install
pattern], and then try to utilize the experience gained from it to build on Windows environment.
In addition to --enable-fpm
configuration parameter, there are two additional parameters as well: --with-fpm-user=USERNAME_HERE
and --with-fpm-group=USERGROUPNAME_HERE
. These two work in *nix environment, but may not be available in Windows.
Overall, I am pretty sure you can build your own PHP-FPM server app on Windows using Visual Studio IDE. There are no official PHP-FPM builds as of the date of this writing.
EDIT 1: Ok, guess I might be wrong re the possibility of building PHP-FPM on Windows, since this SAPI uses libevent
component from *nix environment. Guess you will have to stick with Cygwin-bundled installation after all.
-
Apparently libevent has been removed as of 5.3.4 according to comments on [this page](http://www.php.net/manual/en/install.fpm.install.php) – 93196.93 Aug 29 '11 at 04:43
PHP-FPM is only available to linux as of now. There are some sites that provides a tutorial on how to get php-fpm to run on windows, under cygwin. You can try those guides.

- 53
- 1
-
6PHP-FPM installs rather easily on Windows right now. Even in 2011, your answer visibly were incorrect: (1) if it worked under Cygwin, it worked under Windows and outside Linux (2) it worked on Solaris, FreeBSD, NetBSD, Mac OS X, OpenBSD, etc. – Dereckson Feb 15 '14 at 08:32
On Windows, when you run PHP with IIS and install the "PHP FastCGI" module, you get similar functionality to what is explained about PHP-FPM. In other words, this is not the official PHP-FPM code base, but just similar functionality.
For one, IIS would spawn multiple php-cgi.exe processes (worker processes). And any PHP requests that come in will be handed down to a worker, IIS will dynamically spawn more workers depending on the server resources. These settings are configurable under the "Fast CGI" options for the server tree node on IIS.
That said, I believe performance-wise the php-cgi.exe is not on par with Apache servers.
You can view the installation procedure for IIS 7 here: https://learn.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis
FastCGI addresses the performance issues that are inherent in CGI by providing a mechanism to reuse a single process over and over again for many requests. Additionally, FastCGI maintains compatibility with non-thread-safe libraries by providing a pool of reusable processes and ensuring that each process handles only one request at a time.

- 1,878
- 19
- 13
PHP-FPM uses mainly *NIX specific features and is not likely to ever be ported to Windows. In the end there really isn't the motivation, especially when considering php-cgi was developed to allow Windows specific services to configure it as a fork pool. Yes, they have their differences, but not enough so to push the community into a complete rewrite of PHP-FPM.
Keep in mind that php-cgi on Windows is not just multiple instances of a CGI, but uses a Windows managed pool of forked FastCGI processors which use the same architecture of PHP-FPM. Multiple processes complete the module initialization of PHP, and from these multiple forks are maintained (and restarted when needed) to handle requests. php-cgi hasn't been a CGI since at least as early as PHP3.

- 1,819
- 20
- 27