﻿{"id":1120,"date":"2013-11-05T16:31:39","date_gmt":"2013-11-05T08:31:39","guid":{"rendered":"http:\/\/nick.txtcc.com\/?p=1120"},"modified":"2013-11-05T16:31:39","modified_gmt":"2013-11-05T08:31:39","slug":"%e5%9c%a8windows%e4%b8%8a%e4%bb%a5php-fpm%e7%9a%84%e5%bd%a2%e5%bc%8f%e9%83%a8%e7%bd%b2nginx%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/php\/1120","title":{"rendered":"\u5728windows\u4e0a\u4ee5php-fpm\u7684\u5f62\u5f0f\u90e8\u7f72nginx\u670d\u52a1\u5668"},"content":{"rendered":"<p>In case anyone still needs this info. This is how I setup php-fpm for use with nginx on windows:<\/p>\n<p>Download the .zip file from <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 <a href=\"http:\/\/windows.php.net\/downloads\/releases\/archives\/\">http:\/\/windows.php.net\/downloads\/releases\/archives\/<\/a> because I wanted to match the version running on my production server.<\/p>\n<p>Unzip the file, e.g. unzip into C:\\php-5.3.10-Win32-VC9-x86<\/p>\n<p>Edit the php.ini file as needed. What I did:<\/p>\n<h1>nginx security setting<\/h1>\n<p>cgi.fix_pathinfo=0<\/p>\n<p>extension_dir = &#8220;C:\\php-5.3.10-Win32-VC9-x86\\ext&#8221;\nenable the following modules by uncommenting them:<\/p>\n<p>extension=php_curl.dll\nextension=php_mbstring.dll\nextension=php_mysqli.dll\nCreate a .bat file somewhere, e.g. start-php-fcgi.bat in nginx directory or in the php directory:<\/p>\n<p>@ECHO OFF\nECHO Starting PHP FastCGI&#8230;\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\nDouble 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.<\/p>\n<p>In the php section of nginx.conf I reference the 127.0.0.1:9123:<\/p>\n<p>location ~ .php$ {\nfastcgi_pass    127.0.0.1:9123;\nfastcgi_index   index.php;\nfastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;\ninclude         fastcgi_params;\n}<\/p>","protected":false},"excerpt":{"rendered":"<p>In case anyone still needs this info. This is how I setup php-fpm for use with nginx on windows: Dow&#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,16],"tags":[268,362,17],"class_list":["post-1120","post","type-post","status-publish","format-standard","hentry","category-php","category-other","tag-nginx","tag-php-fpm","tag-windows"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=1120"}],"version-history":[{"count":1,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1120\/revisions"}],"predecessor-version":[{"id":1121,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1120\/revisions\/1121"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=1120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=1120"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=1120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}