﻿{"id":1718,"date":"2018-07-04T17:30:20","date_gmt":"2018-07-04T09:30:20","guid":{"rendered":"http:\/\/nick.txtcc.com\/?p=1718"},"modified":"2018-07-04T17:30:20","modified_gmt":"2018-07-04T09:30:20","slug":"php-fpm-for-windows","status":"publish","type":"post","link":"https:\/\/nick.txtcc.com\/index.php\/php\/1718","title":{"rendered":"php-fpm for Windows?"},"content":{"rendered":"<p>Here how to setup php-fpm on Windows:<\/p>\n<ol>\n    <li>Download the .zip file from\u00a0<a href=\"http:\/\/windows.php.net\/download\/\">http:\/\/windows.php.net\/download\/<\/a>. The .zip file should be VC9 which has the FastCGI file (php-cgi.exe). Don&#8217;t download VC6, and don&#8217;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\u00a0<a href=\"http:\/\/windows.php.net\/downloads\/releases\/archives\/\">http:\/\/windows.php.net\/downloads\/releases\/archives\/<\/a>\u00a0because I wanted to match the version running on my production server.<\/li>\n    <li>Unzip the file, e.g. unzip into C:\\php-5.3.10-Win32-VC9-x86<\/li>\n    <li>Edit the php.ini file as needed. What I did:\n<pre><code># nginx security setting\ncgi.fix_pathinfo=0\n\nextension_dir = &quot;C:\\php-5.3.10-Win32-VC9-x86\\ext&quot;\n<\/code><\/pre>\nenable the following modules by uncommenting them:\n<pre><code>extension=php_curl.dll\nextension=php_mbstring.dll\nextension=php_mysqli.dll\n<\/code><\/pre>\n<\/li>\n    <li>Create a .bat file somewhere, e.g. start-php-fcgi.bat in webserver directory or in the PHP directory:\n<pre><code>@ECHO OFF\nECHO Starting PHP FastCGI...\nset PATH=C:\\php-5.3.10-Win32-VC9-x86;%PATH%\nC:\\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\n<\/code><\/pre>\n<\/li>\n    <li>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&#8217;t looked into setting it up as service yet.<\/li>\n    <li>Configure your webserver. If you wish to use it with nginx, here a config sample for 127.0.0.1:9123:\n<pre><code>location ~ \\.php$ {\n    fastcgi_pass    127.0.0.1:9123;\n    fastcgi_index   index.php;\n    fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n    include         fastcgi_params;\n}<\/code><\/pre>\n<\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Here how to setup php-fpm on Windows: Download the .zip file from\u00a0<a href=\"http:\/\/windows.php.net\/download\/\">http:\/\/windows.php.net\/download\/<\/a>. &#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-1718","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=1718"}],"version-history":[{"count":1,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1718\/revisions"}],"predecessor-version":[{"id":1719,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1718\/revisions\/1719"}],"wp:attachment":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=1718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=1718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=1718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}