{"id":1100,"date":"2012-06-15T14:13:39","date_gmt":"2012-06-15T06:13:39","guid":{"rendered":"https:\/\/blog.rexdf.org\/?p=1054"},"modified":"2012-06-15T14:13:39","modified_gmt":"2012-06-15T06:13:39","slug":"php%e5%9c%a8apache%e4%b8%ad%e7%9a%84%e4%b8%89%e7%a7%8d%e5%b7%a5%e4%bd%9c%e6%96%b9%e5%bc%8f%ef%bc%9acgi%e6%a8%a1%e5%bc%8f%e3%80%81fastcgi%e6%a8%a1%e5%bc%8f%e3%80%81apache-%e6%a8%a1%e5%9d%97dll","status":"publish","type":"post","link":"https:\/\/blog.rexdf.org\/en\/2012\/06\/php%e5%9c%a8apache%e4%b8%ad%e7%9a%84%e4%b8%89%e7%a7%8d%e5%b7%a5%e4%bd%9c%e6%96%b9%e5%bc%8f%ef%bc%9acgi%e6%a8%a1%e5%bc%8f%e3%80%81fastcgi%e6%a8%a1%e5%bc%8f%e3%80%81apache-%e6%a8%a1%e5%9d%97dll\/","title":{"rendered":"php\u5728apache\u4e2d\u7684\u4e09\u79cd\u5de5\u4f5c\u65b9\u5f0f\uff1aCGI\u6a21\u5f0f\u3001FastCGI\u6a21\u5f0f\u3001Apache \u6a21\u5757DLL"},"content":{"rendered":"<p>\u4e0b\u9762\u662fWindows\u7684\u8bbe\u7f6e\u95ee\u9898\uff1a<\/p>\n<p>\u4e00\u3001CGI\u6a21\u5f0f\u4e0e\u6a21\u5757\u6a21\u5f0f\u6bd4\u8f83\uff1a<br \/>\nPHP\u5728apache\u4e2d\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u533a\u522b(CGI\u6a21\u5f0f\u3001Apache \u6a21\u5757DLL)<br \/>\n\u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u5b89\u88c5\uff1a<\/p>\n<p>PHP \u5728 Apache 2.0 \u4e2d\u7684 CGI \u65b9\u5f0f<br \/>\nScriptAlias \/PHP\/ &#8220;c:\/PHP\/&#8221;<br \/>\nAddType application\/x-httpd-PHP .PHP<\/p>\n<p># \u5bf9 PHP 4 \u7528\u8fd9\u884c<br \/>\nAction application\/x-httpd-PHP &#8220;\/PHP\/PHP.exe&#8221;<\/p>\n<p># \u5bf9 PHP 5 \u7528\u8fd9\u884c<br \/>\nAction application\/x-httpd-PHP &#8220;\/PHP\/PHP-cgi.exe&#8221;<br \/>\nPHP \u5728 Apache 2.0 \u4e2d\u7684\u6a21\u5757\u65b9\u5f0f<br \/>\n# \u5bf9 PHP 4 \u7528\u8fd9\u4e24\u884c\uff1a<br \/>\nLoadModule PHP4_module &#8220;c:\/PHP\/PHP4apache2.dll&#8221;<br \/>\n# \u522b\u5fd8\u4e86\u4ece sapi \u76ee\u5f55\u4e2d\u628a PHP4apache2.dll \u62f7\u8d1d\u51fa\u6765\uff01<br \/>\nAddType application\/x-httpd-PHP .PHP<br \/>\n# \u5bf9 PHP 5 \u7528\u8fd9\u4e24\u884c\uff1a<br \/>\nLoadModule PHP5_module &#8220;c:\/PHP\/PHP5apache2.dll&#8221;<br \/>\nAddType application\/x-httpd-PHP .PHP<\/p>\n<p># \u914d\u7f6e PHP.ini \u7684\u8def\u5f84<br \/>\nPHPIniDir &#8220;C:\/PHP&#8221;<\/p>\n<p>\u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u533a\u522b\uff1a<br \/>\n\u5728CGI\u6a21\u5f0f\u4e0b\uff0c\u5982\u679c\u5ba2\u6237\u673a\u8bf7\u6c42\u4e00\u4e2aPHP\u6587\u4ef6\uff0cWeb\u670d\u52a1\u5668\u5c31\u8c03\u7528PHP.exe\u53bb\u89e3\u91ca\u8fd9\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u518d\u628a\u89e3\u91ca\u7684\u7ed3\u679c\u4ee5\u7f51\u9875\u7684\u5f62\u5f0f\u8fd4\u56de\u7ed9\u5ba2\u6237\u673a\uff1b<br \/>\n\u800c\u5728\u6a21\u5757\u5316(DLL)\u4e2d\uff0cPHP\u662f\u4e0eWeb\u670d\u52a1\u5668\u4e00\u8d77\u542f\u52a8\u5e76\u8fd0\u884c\u7684\u3002<br \/>\n\u6240\u4ee5\u4ece\u67d0\u79cd\u89d2\u5ea6\u4e0a\u6765\u8bf4\uff0c\u4ee5apache\u6a21\u5757\u65b9\u5f0f\u5b89\u88c5\u7684 PHP4\u6709\u7740\u6bd4CGI\u6a21\u5f0f\u66f4\u597d\u7684\u5b89\u5168\u6027\u4ee5\u53ca\u66f4\u597d\u7684\u6267\u884c\u6548\u7387\u548c\u901f\u5ea6\u3002<\/p>\n<p>\u4e8c\u3001FastCGI\u8fd0\u884c\u6a21\u5f0f\u5206\u6790\uff1a<br \/>\nFastCGI \u6a21\u5f0f\u8fd0\u884c PHP \u7684\u4f18\u70b9\uff1a<br \/>\n\u4ee5 FastCGI \u6a21\u5f0f\u8fd0\u884c PHP \u6709\u51e0\u4e2a\u4e3b\u8981\u7684\u597d\u5904\u3002\u9996\u5148\u5c31\u662f PHP \u51fa\u9519\u7684\u65f6\u5019\u4e0d\u4f1a\u641e\u57ae Apache\uff0c\u53ea\u662f PHP \u81ea\u5df1\u7684\u8fdb\u7a0b\u5f53\u6389\uff08\u4f46 FastCGI \u4f1a\u7acb\u5373\u91cd\u65b0\u542f\u52a8\u4e00\u4e2a\u65b0 PHP \u8fdb\u7a0b\u6765\u4ee3\u66ff\u5f53\u6389\u7684\u8fdb\u7a0b\uff09\u3002\u5176\u6b21 FastCGI \u6a21\u5f0f\u8fd0\u884c PHP \u6bd4 ISAPI \u6a21\u5f0f\u6027\u80fd\u66f4\u597d\uff08\u6211\u672c\u6765\u7528 ApacheBench \u8fdb\u884c\u4e86\u6d4b\u8bd5\uff0c\u4f46\u5fd8\u4e86\u4fdd\u5b58\u7ed3\u679c\uff0c\u5927\u5bb6\u6709\u5174\u8da3\u53ef\u4ee5\u81ea\u5df1\u6d4b\u8bd5\uff09\u3002<br \/>\n\u6700\u540e\uff0c\u5c31\u662f\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c PHP5 \u548c PHP4\u3002\u53c2\u8003\u4e0b\u9762\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5206\u522b\u5efa\u7acb\u4e86\u4e24\u4e2a\u865a\u62df\u4e3b\u673a\uff0c\u5176\u4e2d\u4e00\u4e2a\u4f7f\u7528 PHP5\uff0c\u53e6\u4e00\u4e2a\u4f7f\u7528 PHP4\u3002<br \/>\nLoadModule fastcgi_module modules\/mod_fastcgi-2.4.2-AP13.dll<br \/>\nScriptAlias \/fcgi-PHP5\/ &#8220;d:\/usr\/local\/PHP-5.0.4\/&#8221;<br \/>\nFastCgiServer &#8220;d:\/usr\/local\/PHP-5.0.4\/PHP-cgi.exe&#8221; -processes 3<br \/>\nScriptAlias \/fcgi-PHP4\/ &#8220;d:\/usr\/local\/PHP-4.3.11\/&#8221;<br \/>\nFastCgiServer &#8220;d:\/usr\/local\/PHP-4.3.11\/PHP.exe&#8221;<br \/>\nListen 80<br \/>\nNameVirtualHost *:80<br \/>\nDocumentRoot d:\/www<br \/>\nOptions Indexes FollowSymlinks MultiViews<br \/>\nServerName PHP5.localhost<br \/>\nAddType application\/x-httpd-fastPHP5 .PHP<br \/>\nAction application\/x-httpd-fastPHP5 &#8220;\/fcgi-PHP5\/PHP-cgi.exe&#8221;<\/p>\n<p>IndexOptions FancyIndexing FoldersFirst<br \/>\nOptions Indexes FollowSymLinks MultiViews<br \/>\nAllowOverride None<br \/>\nOrder allow,deny<br \/>\nAllow from all<\/p>\n<p>Listen 8080<br \/>\nNameVirtualHost *:8080<\/p>\n<p>DocumentRoot d:\/www<br \/>\nOptions Indexes FollowSymlinks MultiViews<br \/>\nServerName PHP4.localhost<br \/>\nAddType application\/x-httpd-fastPHP4 .PHP<br \/>\nAction application\/x-httpd-fastPHP4 &#8220;\/fcgi-PHP4\/PHP.exe&#8221;<\/p>\n<p>Options Indexes FollowSymLinks MultiViews<br \/>\nAllowOverride None<br \/>\nOrder allow,deny<br \/>\nAllow from all<\/p>\n<p>\u4f7f\u7528\u4e0a\u9762\u7684\u914d\u7f6e\uff0c\u8bbf\u95eehttp:\/\/localhost\/\u5c31\u4f7f\u7528 PHP5\uff0c\u800c\u8bbf\u95eehttp:\/\/localhost:8080\/\u5c31\u4f7f\u7528 PHP4\u3002\u6240\u4ee5\u53ea\u8981\u5408\u7406\u914d\u7f6e\uff0c\u5c31\u53ef\u4ee5\u8ba9\u4e0d\u540c\u7684\u865a\u62df\u4e3b\u673a\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u7684 PHP\u3002<\/p>\n<p>FastCGI \u6a21\u5f0f\u7684\u4e00\u4e9b\u7f3a\u70b9\uff1a<br \/>\n\u4ece \u5b9e\u9645\u4f7f\u7528\u6765\u770b\uff0c\u7528 FastCGI \u6a21\u5f0f\u66f4\u9002\u5408\u751f\u4ea7\u73af\u5883\u7684\u670d\u52a1\u5668\u3002\u4f46\u5bf9\u4e8e\u5f00\u53d1\u7528\u673a\u5668\u6765\u8bf4\u5c31\u4e0d\u592a\u5408\u9002\u3002\u56e0\u4e3a\u5f53\u4f7f\u7528 Zend Studio \u8c03\u8bd5\u7a0b\u5e8f\u65f6\uff0c\u7531\u4e8e FastCGI \u4f1a\u8ba4\u4e3a PHP \u8fdb\u7a0b\u8d85\u65f6\uff0c\u4ece\u800c\u5728\u9875\u9762\u8fd4\u56de 500 \u9519\u8bef\u3002\u8fd9\u4e00\u70b9\u8ba9\u4eba\u975e\u5e38\u607c\u706b\uff0c\u6240\u4ee5\u6211\u5728\u5f00\u53d1\u673a\u5668\u4e0a\u8fd8\u662f\u6362\u56de\u4e86 ISAPI \u6a21\u5f0f\u3002<br \/>\n\u6700\u540e\uff0c\u5728 Windows \u4e2d\u4ee5 FastCGI \u6a21\u5f0f\u5b58\u5728\u6f5c\u5728\u7684\u5b89\u5168\u6f0f\u6d1e\u3002\u56e0\u4e3a\u6211\u8fd8\u6ca1\u6709\u627e\u5230\u5982\u4f55\u5728 Windows \u73af\u5883\u4e0b\u5b9e\u73b0 HTML&#8221; target=&#8221;_blank&#8221;&gt;SuEXEC \u7684\u65b9\u6cd5\uff0c\u56e0\u6b64 PHP \u7684\u8fdb\u7a0b\u603b\u662f\u4ee5\u6700\u9ad8\u6743\u9650\u8fd0\u884c\uff0c\u8fd9\u4ece\u5b89\u5168\u89d2\u5ea6\u6765\u770b\u663e\u7136\u4e0d\u662f\u4e2a\u597d\u6d88\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u662fWindows\u7684\u8bbe\u7f6e\u95ee\u9898\uff1a \u4e00\u3001CGI\u6a21\u5f0f\u4e0e\u6a21\u5757\u6a21\u5f0f\u6bd4\u8f83\uff1a PHP\u5728apache\u4e2d\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u533a\u522b(CGI\u6a21\u5f0f\u3001Apache \u6a21\u5757DLL) \u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u5b89\u88c5\uff1a PHP \u5728 Apache 2.0 \u4e2d\u7684 CGI \u65b9\u5f0f ScriptAlias \/PHP\/ &#8220;c:\/PHP\/&#8221; AddType application\/x-httpd-PHP .PHP # \u5bf9 PHP 4 \u7528\u8fd9\u884c Action application\/x-httpd-PHP &#8220;\/PHP\/PHP.exe&#8221; # \u5bf9 PHP 5 \u7528\u8fd9\u884c Action application\/x-httpd-PHP &#8220;\/PHP\/PHP-cgi.exe&#8221; PHP \u5728 Apache 2.0 \u4e2d\u7684\u6a21\u5757\u65b9\u5f0f # &hellip; <a href=\"https:\/\/blog.rexdf.org\/en\/2012\/06\/php%e5%9c%a8apache%e4%b8%ad%e7%9a%84%e4%b8%89%e7%a7%8d%e5%b7%a5%e4%bd%9c%e6%96%b9%e5%bc%8f%ef%bc%9acgi%e6%a8%a1%e5%bc%8f%e3%80%81fastcgi%e6%a8%a1%e5%bc%8f%e3%80%81apache-%e6%a8%a1%e5%9d%97dll\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[19],"tags":[29],"class_list":["post-1100","post","type-post","status-publish","format-standard","hentry","category-site-build","tag-apache"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/posts\/1100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/comments?post=1100"}],"version-history":[{"count":0,"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/posts\/1100\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/media?parent=1100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/categories?post=1100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.rexdf.org\/en\/wp-json\/wp\/v2\/tags?post=1100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}