{"id":1017,"date":"2009-12-11T14:51:00","date_gmt":"2009-12-11T06:51:00","guid":{"rendered":"\/?p=1017"},"modified":"2009-12-11T14:51:00","modified_gmt":"2009-12-11T14:51:00","slug":"1017","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/php\/1017.html","title":{"rendered":"PHP\u5728Apache\u4e2d\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u533a\u522b(CGI\u6a21\u5f0f\u3001Apache \u6a21\u5757DLL)"},"content":{"rendered":"

        Windows \u4e0b\u6709\u4e24\u79cd\u65b9\u6cd5\u4f7f PHP \u5de5\u4f5c\u4e8e Apache 2.0.x \u4e4b\u4e2d\u3002\u4e00\u79cd\u662f \u4f7f\u7528 CGI \u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u53e6\u4e00\u79cd\u662f\u9002\u7528 Apache \u6a21\u5757\u7684 DLL\u3002                       
\u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u5b89\u88c5\uff1a<\/p>\n

PHP \u5728 Apache 2.0 \u4e2d\u7684 CGI \u65b9\u5f0f
ScriptAlias \/php\/ "c:\/php\/"
AddType application\/x-httpd-php .php<\/p>\n

# \u5bf9 PHP 4 \u7528\u8fd9\u884c
Action application\/x-httpd-php "\/php\/php.exe"
# \u5bf9 PHP 5 \u7528\u8fd9\u884c
Action application\/x-httpd-php "\/php\/php-cgi.exe"
PHP \u5728 Apache 2.0 \u4e2d\u7684\u6a21\u5757\u65b9\u5f0f
# \u5bf9 PHP 4 \u7528\u8fd9\u4e24\u884c\uff1a
LoadModule php4_module "c:\/php\/php4apache2.dll"
# \u522b\u5fd8\u4e86\u4ece sapi \u76ee\u5f55\u4e2d\u628a php4apache2.dll \u62f7\u8d1d\u51fa\u6765\uff01
AddType application\/x-httpd-php .php<\/p>\n

# \u5bf9 PHP 5 \u7528\u8fd9\u4e24\u884c\uff1a
LoadModule php5_module "c:\/php\/php5apache2.dll"
AddType application\/x-httpd-php .php
# \u914d\u7f6e php.ini \u7684\u8def\u5f84
PHPIniDir "C:\/php"<\/p>\n

\u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u533a\u522b\uff1a
\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
\u800c\u5728\u6a21\u5757\u5316(DLL)\u4e2d\uff0cPHP\u662f\u4e0eWeb\u670d\u52a1\u5668\u4e00\u8d77\u542f\u52a8\u5e76\u8fd0\u884c\u7684\u3002
\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

\u4e00\u3001FastCGI\u662f\u4ec0\u4e48\uff1f
\u3000\u3000FastCGI\u662f\u8bed\u8a00\u65e0\u5173\u7684\u3001\u53ef\u4f38\u7f29\u67b6\u6784\u7684CGI\u5f00\u653e\u6269\u5c55\uff0c\u5176\u4e3b\u8981\u884c\u4e3a\u662f\u5c06CGI\u89e3\u91ca\u5668\u8fdb\u7a0b\u4fdd\u6301\u5728\u5185\u5b58\u4e2d\u5e76\u56e0\u6b64\u83b7\u5f97\u8f83\u9ad8\u7684\u6027\u80fd\u3002\u4f17\u6240\u5468\u77e5\uff0cCGI\u89e3\u91ca\u5668\u7684\u53cd\u590d\u52a0\u8f7d\u662fCGI\u6027\u80fd\u4f4e\u4e0b\u7684\u4e3b\u8981\u539f\u56e0\uff0c\u5982\u679cCGI\u89e3\u91ca\u5668\u4fdd\u6301\u5728\u5185\u5b58\u4e2d\u5e76\u63a5\u53d7FastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\u8c03\u5ea6\uff0c\u5219\u53ef\u4ee5\u63d0\u4f9b\u826f\u597d\u7684\u6027\u80fd\u3001\u4f38\u7f29\u6027\u3001Fail-Over\u7279\u6027\u7b49\u7b49\u3002
FastCGI\u7684\u5b98\u65b9\u7ad9\u70b9\u5728http:\/\/www.fastcgi.com<\/a><\/p>\n

\u3000\u3000FastCGI\u7684\u5de5\u4f5c\u539f\u7406\u662f\uff1a
\u3000\u30001\u3001Web Server \u542f\u52a8\u65f6\u8f7d\u5165FastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\uff08IIS ISAPI\u6216Apache Module\uff09;
\u3000\u30002\u3001FastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\u81ea\u8eab\u521d\u59cb\u5316\uff0c\u542f\u52a8\u591a\u4e2aCGI\u89e3\u91ca\u5668\u8fdb\u7a0b (\u5728\u4efb\u52a1\u7ba1\u7406\u5668\u4e2d\u53ef\u89c1\u591a\u4e2aphp-cgi.exe)\u5e76\u7b49\u5f85\u6765\u81eaWeb Server\u7684\u8fde\u63a5\u3002
\u3000\u30003\u3001\u5f53\u5ba2\u6237\u7aef\u8bf7\u6c42\u5230\u8fbeWeb Server\u65f6\uff0cFastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\u9009\u62e9\u5e76\u8fde\u63a5\u5230\u4e00\u4e2aCGI\u89e3\u91ca\u5668\u3002Web server\u5c06CGI\u73af\u5883\u53d8\u91cf\u548c\u6807\u51c6\u8f93\u5165\u53d1\u9001\u5230FastCGI\u5b50\u8fdb\u7a0bphp-cgi.exe\u3002
\u3000\u30004\u3001FastCGI\u5b50\u8fdb\u7a0b\u5b8c\u6210\u5904\u7406\u540e\u5c06\u6807\u51c6\u8f93\u51fa\u548c\u9519\u8bef\u4fe1\u606f\u4ece\u540c\u4e00\u8fde\u63a5\u8fd4\u56deWeb Server\u3002\u5f53FastCGI\u5b50\u8fdb\u7a0b\u5173\u95ed\u8fde\u63a5\u65f6\uff0c\u8bf7\u6c42\u4fbf\u544a\u5904\u7406\u5b8c\u6210\u3002FastCGI\u5b50\u8fdb\u7a0b\u63a5\u7740\u7b49\u5f85\u5e76\u5904\u7406\u6765\u81eaFastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\uff08\u8fd0\u884c\u5728 WebServer\u4e2d\uff09\u7684\u4e0b\u4e00\u4e2a\u8fde\u63a5\u3002 \u5728\u6b63\u5e38\u7684CGI\u6a21\u5f0f\u4e2d\uff0cphp-cgi.exe\u5728\u6b64\u4fbf\u9000\u51fa\u4e86\u3002<\/p>\n

\u3000\u3000\u5728\u4e0a\u8ff0\u60c5\u51b5\u4e2d\uff0c\u4f60\u53ef\u4ee5\u60f3\u8c61 CGI\u901a\u5e38\u6709\u591a\u6162\u3002\u6bcf\u4e00\u4e2aWeb\u8bf7\u6c42PHP\u90fd\u5fc5\u987b\u91cd\u65b0\u89e3\u6790php.ini\u3001\u91cd\u65b0\u8f7d\u5165\u5168\u90e8dll\u6269\u5c55\u5e76\u91cd\u521d\u59cb\u5316\u5168\u90e8\u6570\u636e\u7ed3\u6784\u3002\u4f7f\u7528FastCGI\uff0c\u6240\u6709\u8fd9\u4e9b\u90fd\u53ea\u5728\u8fdb\u7a0b\u542f\u52a8\u65f6\u53d1\u751f\u4e00\u6b21\u3002\u4e00\u4e2a\u989d\u5916\u7684\u597d\u5904\u662f\uff0c\u6301\u7eed\u6570\u636e\u5e93\u8fde\u63a5(Persistent database connection)\u53ef\u4ee5\u5de5\u4f5c\u3002<\/p>\n

\u4e8c\u3001\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528FastCGI\uff0c\u800c\u4e0d\u662f\u591a\u7ebf\u7a0bCGI\u89e3\u91ca\u5668\uff1f
\u3000\u3000\u8fd9\u53ef\u80fd\u51fa\u4e8e\u591a\u65b9\u9762\u7684\u8003\u8651\uff0c\u4f8b\u5982\uff1a
\u3000\u30001\u3001\u4f60\u65e0\u8bba\u5982\u4f55\u4e5f\u4e0d\u80fd\u5728windows\u5e73\u53f0\u4e0a\u7a33\u5b9a\u7684\u4f7f\u7528\u591a\u7ebf\u7a0bCGI\u89e3\u91ca\u5668\uff0c\u65e0\u8bba\u662fIIS ISAPI\u65b9\u5f0f\u8fd8\u662fAPACHE Module\u65b9\u5f0f\uff0c\u5b83\u4eec\u603b\u662f\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u5c31\u5d29\u6e83\u4e86\u3002\u5947\u602a\u4e48\uff1f\u4f46\u662f\u786e\u5b9e\u5b58\u5728\u8fd9\u6837\u7684\u60c5\u51b5\uff01
\u3000\u3000\u5f53\u7136\uff0c\u4e5f\u6709\u5f88\u591a\u65f6\u5019\u4f60\u80fd\u591f\u7a33\u5b9a\u7684\u4f7f\u7528\u591a\u7ebf\u7a0bCGI\u89e3\u91ca\u5668\uff0c\u4f46\u662f\uff0c\u4f60\u6709\u53ef\u80fd\u53d1\u73b0\u7f51\u9875\u6709\u65f6\u5019\u4f1a\u51fa\u73b0\u9519\u8bef\uff0c\u65e0\u8bba\u5982\u4f55\u4e5f\u627e\u4e0d\u5230\u539f\u56e0\uff0c\u800c\u6362\u7528FastCGI\u65b9\u5f0f\u65f6\u8fd9\u79cd\u9519\u8bef\u7684\u6982\u7387\u4f1a\u5927\u5927\u7684\u964d\u4f4e\u3002\u6211\u4e5f\u4e0d\u6e05\u695a\u8fd9\u662f\u4e3a\u4ec0\u4e48\uff0c\u6211\u60f3\u72ec\u7acb\u5730\u5740\u7a7a\u95f4\u7684CGI\u89e3\u91ca\u5668\u53ef\u80fd\u7ec8\u7a76\u6bd4\u5171\u4eab\u5730\u5740\u7a7a\u95f4\u7684\u5f62\u5f0f\u6765\u5f97\u7a33\u5b9a\u4e00\u70b9\u70b9\u3002
\u3000\u30002\u3001\u6027\u80fd\uff01\u6027\u80fd\uff1f\u53ef\u80fd\u4e48\uff0c\u96be\u9053FastCGI\u6bd4\u591a\u7ebf\u7a0bCGI\u89e3\u91ca\u5668\u66f4\u5feb\uff1f\u4f46\u6709\u65f6\u5019\u786e\u5b9e\u662f\u8fd9\u6837\uff0c\u53ea\u6709\u6d4b\u8bd5\u4e00\u4e0b\u4f60\u7684\u7f51\u7ad9\uff0c\u624d\u80fd\u6700\u540e\u4e0b\u7ed3\u8bba\u3002\u539f\u56e0\u561b\uff0c\u6211\u89c9\u5f97\u5f88\u96be\u8bb2\uff0c\u4f46\u6709\u8d44\u6599\u8bf4\u5728Zend WinEnabler\u7684\u65f6\u4ee3\uff0cZend\u539f\u6765\u4e5f\u662f\u5efa\u8bae\u5728Windows\u5e73\u53f0\u4e0b\u4f7f\u7528FastCGI\u800c\u4e0d\u662fIIS ISAPI\u6216Apache Module\uff0c\u4e0d\u8fc7\u73b0\u5728Zend\u5df2\u7ecf\u4e0d\u505a\u8fd9\u4e2a\u4ea7\u54c1\u4e86\u3002<\/p>\n

\u4e09\u3001\u4e0d\u4f7f\u7528FastCGI\u7684\u7406\u7531
\u3000\u30001\u3001\u591a\u8fdb\u7a0b\u6bd4\u591a\u7ebf\u7a0b\u6d88\u8017\u66f4\u591a\u7684\u670d\u52a1\u5668\u5185\u5b58\uff0cphp-cgi.exe\u89e3\u91ca\u5668\u6bcf\u8fdb\u7a0b\u6d88\u80177\u81f325\u5146\u5185\u5b58\uff0c\u5c06\u8fd9\u4e2a\u6570\u5b57\u4e58\u4ee550\u6216100\u8bd5\u8bd5\u3002
\u3000\u30002\u3001\u6027\u80fd\u3002\u786e\u5b9e\u6709\u65f6\u5019\u591a\u7ebf\u7a0bCGI\u89e3\u91ca\u5668\u66f4\u5feb\uff0c\u5475\u5475\uff0c\u800c\u4e14\u6709\u65f6\u5019\uff0c\u5b83\u4e5f\u5f88\u7a33\u5b9a\u3002
\u3000\u30003\u3001CGI\uff1f\u542c\u8d77\u6765\u5c31\u5f88\u571f\uff0c\u5475\u5475<\/p>\n

\u56db\u3001IIS FastCGI\u914d\u7f6e\u65b9\u6cd5
\u3000\u30001\u3001\u9996\u5148\u786e\u5b9a\u4f60\u5df2\u6b63\u786e\u5b89\u88c5\u4e86PHP 4.3.x\u53ca\u66f4\u65b0\u7684\u7248\u672c\u3002\u65e9\u671f\u7248\u672c\u7684PHP\u5e76\u672a\u9ed8\u8ba4\u52a0\u5165FastCGI\u652f\u6301\uff0c\u5982\u679c\u4f60\u60f3\u5728\u65e9\u671f\u7248\u672c\u4e2d\u5de5\u4f5c\uff0c\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5b83\u3002\u6211\u4eec\u5047\u8bbePHP\u5b89\u88c5\u5728c:\\php\uff0c\u652f\u6301FastFCGI\u7684\u53ef\u6267\u884c\u6587\u4ef6\u540d\u662fphp-cgi.exe\u3002
\u3000\u3000\u3000\u3000\u6ce8\u610f\uff1a\u5efa\u8bae\u5728Php.ini\u4e2d\u5173\u95edcgi.force_redirect\uff0c\u542f\u7528fastcgi.impersonate\uff0c\u542f\u7528cgi.rfc2616_header<\/p>\n

\u3000\u30002\u3001\u4e0b\u8f7dhttp:\/\/www.caraveo.com\/fastcgi\/fastcgi-0.6.zip<\/a>\u5e76\u5c06\u5176\u4e2d\u7684isapi_fcgi.dll\u89e3\u538b\u7f29\u5230c:\\php\u76ee\u5f55\u4e0b\uff08\u4e0d\u662f\u5fc5\u987b\u5728\u6b64\u76ee\u5f55\uff0c\u8fd9\u91cc\u53ea\u662f\u53d9\u8ff0\u65b9\u4fbf\uff09\u3002<\/p>\n

\u3000\u30003\u3001\u4f7f\u7528regedit.exe\u5efa\u7acb\u5982\u4e0b\u6ce8\u518c\u8868\u9879\uff1a
\u3000\u3000HKEY_LOCAL_MACHINE:Software\\FASTCGI\\.php\u3000\uff08\u5fc5\u9700\uff09<\/p>\n

\u3000\u30004\u3001\u5728\u6b64\u9879\u4e0b\u5efa\u7acb\u5982\u4e0b\u952e\u503c\uff1a
\u3000\u3000\u5b57\u7b26\u4e32\u7c7b\u578b\uff1aAppPath\uff0c\u503c\u4e3ac:\\php\\php-cgi.exe\u3000\uff08\u5fc5\u9700\uff09
\u3000\u3000\u5b57\u7b26\u4e32\u7c7b\u578b\uff1aBindPath\uff0c\u503c\u4e3aphp-fcgi\u3000\u3000\u3000\u3000\u3000 \uff08\u5fc5\u9700\uff09
\u3000\u3000\u4ee5\u4e0b\u662f\u53ef\u9009\u914d\u7f6e\u952e\u503c\uff1a
\u3000\u3000DWORD\u7c7b\u578b\uff1aStartServers\uff0c\u542f\u52a8\u65f6\u9ed8\u8ba4\u542f\u52a8\u7684\u89e3\u91ca\u5668\u4e2a\u6570\uff0c\u9ed8\u8ba4\u503c5
\u3000\u3000DWORD\u7c7b\u578b\uff1aMaxServers\uff0c\u6700\u5927\u89e3\u91ca\u5668\u4e2a\u6570\uff0c\u9ed8\u8ba425
\u3000\u3000DWORD\u7c7b\u578b\uff1aIncrementServers\uff0c\u5f53\u89e3\u91ca\u5668\u4e0d\u591f\u7528\u65f6\u589e\u91cf\u4e2a\u6570\uff0c\u9ed8\u8ba42
\u3000\u3000DWORD\u7c7b\u578b\uff1aTimeout\uff0c\u589e\u91cf\u89e3\u91ca\u5668\uff08\u8d85\u51faStartServers\u6570\u76ee\u7684\uff09\u5b58\u6d3b\u65f6\u95f4\uff0c\u9ed8\u8ba4600\uff08\u79d2\uff09
\u3000\u3000DWORD\u7c7b\u578b\uff1aThreadPoolSize\uff0c\u7ebf\u7a0b\u6c60\u5927\u5c0f\uff0c\u4ec5IIS\u4e0b\u6709\u6548\uff0c\u9ed8\u8ba410
\u3000\u3000DWORD\u7c7b\u578b\uff1aImpersonate\uff0c\u4ec5IIS\u6709\u6548\uff0c\u5982\u679c\u4e3a1\uff0c\u4f7f\u7528IIS\u5b89\u5168\u6807\u5fd7\uff0c\u4e3a0\u5219\u5173\u95ed\u6b64\u7279\u6027\u3002\u4e0d\u8981\u5173\u95ed\u5b83\u9664\u975e\u4f60\u4e0d\u62c5\u5fc3\u5b89\u5168\u95ee\u9898\u3002\u9ed8\u8ba41
\u3000\u3000DWORD\u7c7b\u578b\uff1aMaxPostData\uff0cPost\u6570\u636e\u9884\u8bfbByte\u9650\u5236\uff0c\u9ed8\u8ba40
\u3000\u3000DWORD\u7c7b\u578b\uff1aBypassAuth\uff0c\u4ec5IIS\u6709\u6548\uff0c\u5982\u679c\u4e3a1\u5e76\u4e14isapi_fcgi.dll\u88ab\u914d\u7f6e\u4e3aIIS Filter\uff0c\u540c\u65f6IIS\u88ab\u914d\u7f6e\u4e3a\u4f7f\u7528BASIC Authentication\uff0c\u8fd9\u5c06\u5f3a\u5236\u6240\u6709\u8ba4\u8bc1\u8bf7\u6c42\u4f7f\u7528IIS\u533f\u540d\u7528\u6237\u3002\u8fd9\u4e00\u9009\u9879\u7684\u76ee\u7684\u662f\u5141\u8bb8\u811a\u672c\u5b9e\u73b0\u81ea\u5df1\u7684\u5b89\u5168\u673a\u5236\u3002\u9ed8\u8ba40
\u3000\u3000BINARY\u7c7b\u578b\uff1aCustomVars\uff0c\u9644\u52a0\u73af\u5883\u53d8\u91cf\u503c\uff0c\u65b0\u884c\u5206\u9694\uff0cNull\u7ed3\u675f<\/p>\n

\u3000\u30005\u3001\u5982\u679c\u662fIIS6\uff0c\u6dfb\u52a0\u4e00\u4e2aWeb\u670d\u52a1\u6269\u5c55\u6307\u5411c:\\php\\isapi_fcgi.dll\uff0c\u5e76\u5141\u8bb8\u3002\u5e94\u7528\u7a0b\u5e8f\u6c60\u4e2d\u7684\u201c\u6700\u5927\u5de5\u4f5c\u8fdb\u7a0b\u6570\u201d\u8bf7\u4fdd\u6301\u4e3a1\u3002<\/p>\n

\u3000\u30006\u3001\u6dfb\u52a0\u5e94\u7528\u7a0b\u5e8f\u6269\u5c55\u6620\u5c04\u5173\u7cfb\uff1a
      1). \u5728Internet\u4fe1\u606f\u670d\u52a1\u7ba1\u7406\u5668\u4e2d\uff0c\u9009\u62e9\u7f51\u7ad9\u6216\u5e94\u7528\u7a0b\u5e8f\u7684\u6839\u76ee\u5f55\u3002
      2). \u6253\u5f00\u76ee\u5f55\u5c5e\u6027\u9875\uff08\u53f3\u952e\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff09\uff0c\u518d\u9009\u62e9\u201c\u4e3b\u76ee\u5f55\u201d\u3002
      3). \u70b9\u51fb\u201c\u914d\u7f6e\u201d\u6309\u94ae\uff0c\u9009\u62e9\u201c\u6620\u5c04\u201dTab\u9875\u3002
      4). \u70b9\u51fb\u201c\u6dfb\u52a0…\u201d\uff0c\u5728\u201c\u53ef\u6267\u884c\u6587\u4ef6\u201d\u8bbe\u4e3a: c:\\php\\isapi_fcgi.dll\uff0c\u6269\u5c55\u540d\u8bbe\u4e3a.php\uff0c\u4e00\u5b9a\u8981\u9009\u62e9\u201c\u786e\u8ba4\u6587\u4ef6\u662f\u5426\u5b58\u5728\u201d\uff0c\u7136\u540e\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002
      5). \u518d\u540c\u6837\u6dfb\u52a0\u5bf9.php3\u6216.phtml\u6269\u5c55\u540d\u7684\u652f\u6301\uff08\u53ef\u9009\uff09\u3002
      6). \u4fdd\u5b58\u8bbe\u5b9a\u5e76\u91cd\u65b0\u542f\u52a8IIS\u3002<\/p>\n

\u3000\u30007\u3001\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u540c\u65f6\u8bf7\u6c42\u591a\u4e2aWeb\u9875\u9762\uff0c\u7136\u540e\u5bdf\u770b\u4efb\u52a1\u7ba1\u7406\u5668\u4e2d\u7684\u8fdb\u7a0b\uff0c\u9875\u9762\u5b8c\u6210\u540ephp-cgi.exe\u8fdb\u7a0b\u6301\u7eed\u8fd0\u884c\u5e76\u4e0d\u9000\u51fa\u3002<\/p>\n

\u4e94\u3001Apache\u914d\u7f6e\u65b9\u6cd5
\u3000\u30001\u3001\u9996\u5148\u786e\u5b9a\u4f60\u5df2\u6b63\u786e\u5b89\u88c5\u4e86PHP 4.3.x\u53ca\u66f4\u65b0\u7684\u7248\u672c\u3002\u65e9\u671f\u7248\u672c\u7684PHP\u5e76\u672a\u9ed8\u8ba4\u52a0\u5165FastCGI\u652f\u6301\uff0c\u5982\u679c\u4f60\u60f3\u5728\u65e9\u671f\u7248\u672c\u4e2d\u5de5\u4f5c\uff0c\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5b83\u3002\u6211\u4eec\u5047\u8bbePHP\u5b89\u88c5\u5728c:\\php\uff0c\u652f\u6301FastFCGI\u7684\u53ef\u6267\u884c\u6587\u4ef6\u540d\u662fphp-cgi.exe\u3002
\u3000\u3000\u3000\u3000\u6ce8\u610f\uff1a\u5efa\u8bae\u5728Php.ini\u4e2d\u6253\u5f00cgi.force_redirect\uff0c\u5173\u95edfastcgi.impersonate\uff0c\u5173\u95edcgi.rfc2616_headers\u3002<\/p>\n

\u3000\u30002\u3001\u4e0b\u8f7dhttp:\/\/www.fastcgi.com\/dist\/mod_fastcgi-2.4.2-AP20.dll<\/a>\uff0c\u653e\u5230Apache 2.x\u7684Modules\u76ee\u5f55\u4e2d\u3002<\/p>\n

\u3000\u30003\u3001\u786e\u5b9aApache 2.x\u5728CGI\u65b9\u5f0f\u4e0b\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884cPHP\u3002httpd.conf\u4e2d\u5b58\u5728\u5982\u4e0b\u51e0\u884c\uff1a
\u3000\u3000\u3000\u3000ScriptAlias \/php\/ "c:\/php\/"
\u3000\u3000\u3000\u3000Action application\/x-httpd-php "\/php\/php-cgi.exe"
\u3000\u3000\u3000\u3000SetEnv PHPRC "C:\/php"
\u3000\u3000\u3000\u3000AddType application\/x-httpd-php .php<\/p>\n

\u3000\u30004\u3001\u5728httpd.conf\u4e2d\u6dfb\u52a0:
\u3000\u3000\u3000\u3000LoadModule fastcgi_module modules\/mod_fastcgi-2.4.2-AP20.dll
\u3000\u3000\u3000\u3000# \u8bf4\u660e\uff1a\u6b64\u5904\u7684 -processes 3 \u8868\u793a\u542f\u52a8\u4e09\u4e2a php-cgi.exe \u8fdb\u7a0b\uff0c
\u3000\u3000\u3000\u3000# \u5173\u4e8e FastCgiServer \u7684\u8be6\u7ec6\u53c2\u6570\u8bf7\u53c2\u8003 FastCGI \u6587\u6863\u3002
\u3000\u3000\u3000\u3000FastCgiServer "c:\/php\/php-cgi.exe" -processes 3<\/p>\n

\u3000\u30005\u3001\u91cd\u65b0\u542f\u52a8Apache\uff0c\u6d4b\u8bd5\u540c\u4e0a\u3002<\/p>\n

\u516d\u3001\u9ad8\u7ea7\u914d\u7f6e
\u3000\u3000\u8bbe\u60f3\u8fd9\u6837\u4e00\u79cd\u573a\u666f\uff0c\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u540c\u65f6\u8dd1Apache 2\u548cIIS 6\uff0c\u4e24\u4e2aWeb\u670d\u52a1\u5668\u90fd\u8dd1php\u5e94\u7528\u3002\u90a3\u4e48\uff0c\u6709\u5982\u4e0b\u4e09\u79cd\u53ef\u80fd\uff1a
\u3000\u3000A\u3001php\u4f7f\u7528iis isapi\u548capache module\u5b89\u88c5\uff0c\u5747\u4e3a\u591a\u7ebf\u7a0b\u65b9\u5f0f\u8fd0\u884c\u3002\u8fd9\u4e2a\u548cFastCGI\u6ca1\u6709\u5173\u7cfb\u3002
\u3000\u3000B\u3001\u5176\u4e2d\u4e00\u4e2a\u670d\u52a1\u5668\u4f7f\u7528FastCGI\u65b9\u5f0f\uff0c\u53e6\u4e00\u4e2a\u4f7f\u7528\u591a\u7ebf\u7a0b\u65b9\u5f0f\u3002\u8fd9\u4e2a\u80fd\u8fd0\u884c\u6b63\u5e38\u3002
\u3000\u3000C\u3001\u4e24\u4e2a\u5747\u4f7f\u7528FastCGI\u65b9\u5f0f\uff0c\u8fd9\u4e2a\u5f80\u5f80\u4e0d\u6b63\u5e38\u3002\u4e00\u822c\u8868\u73b0\u4e3a\uff1a
\u3000\u3000\u3000\u3000\u4e24\u4e2a\u670d\u52a1\u5668\u5404\u81ea\u542f\u52a8\u4e00\u4e9bphp-cgi.exe\u8fdb\u7a0b\uff0c\u7136\u540e\u670d\u52a1\u5668\u4e4b\u4e00\u4e0d\u89e3\u91caphp\u9875\u9762\uff0c\u6216\u8005\u9694\u4e00\u4f1a\u513f\u5c31\u6d3e\u751f\u65b0\u7684php-cgi.exe\u8fdb\u7a0b\uff08\u53ef\u6015\u5440\uff09\u3002<\/p>\n

\u3000\u3000\u4e3a\u4ec0\u4e48\u5462\uff1f\u6211\u60f3\u5927\u6982\u662f\u56e0\u4e3a\u4e0a\u9762\u4f7f\u7528\u7684\u4e24\u4e2a\u4e1c\u897f\uff08iis isapi\u548capache module\uff09\u7684\u4f5c\u8005\u5927\u6982\u5e76\u6ca1\u6709\u60f3\u8fc7\u8981\u548c\u5bf9\u65b9\u540c\u65f6\u4f7f\u7528\u5427\uff0c\u5475\u5475\u3002\u60f3\u4e86\u60f3\uff0cApache 2\u548cIIS 6\u5982\u679c\u53ef\u4ee5\u5171\u7528\u4e00\u6279php-cgi.exe\u89e3\u91ca\u5668\u5c31\u597d\u4e86\uff0c\u65e2\u4e0d\u6d6a\u8d39\u5185\u5b58\uff0c\u4f30\u8ba1\u4e5f\u4e0d\u4f1a\u6709\u8c03\u5ea6\u95ee\u9898\u4e86\u3002
\u3000\u3000\u7ecf\u8fc7\u7814\u7a76\u548c\u6d4b\u8bd5\u8bc1\u660e\uff0c\u8fd9\u4e2a\u60f3\u6cd5\u662f\u53ef\u884c\u7684\u3002\u4f46\u662f\uff0c\u7531\u4e8eShane Caraveo\u5e76\u672a\u5728ISAPI DLL\u4e2d\u63d0\u4f9b\u4f7f\u7528\u5916\u7f6eFastCGI\u670d\u52a1\u7684\u529f\u80fd\uff0c\u56e0\u6b64\u5728\u6b64\u573a\u666f\u4e2d\u53ea\u80fd\u662f\u7531IIS\u8d1f\u8d23\u542f\u52a8\u548c\u7ba1\u7406php-cgi.exe\uff0c\u7136\u540e\u914d\u7f6eApache\u53bb\u4f7f\u7528\u8fd9\u4e9b\u53d7 IIS\u7ba1\u7406\u7684php-cgi.exe\u8fdb\u7a0b\u3002<\/p>\n

\u3000\u3000\u914d\u7f6e\u65b9\u6cd5\uff1a
\u3000\u30001\u3001\u6309\u4e0a\u8ff0\u56db\u4e2d\u7684\u65b9\u6cd5\u914d\u7f6eIIS FastCGI\u3002
\u3000\u30002\u3001\u57fa\u672c\u6309\u4e0a\u8ff0\u4e94\u4e2d\u7684\u65b9\u6cd5\u914d\u7f6eApache FastCGI\uff0c\u4e94.4\u6539\u4e3a\u5728httpd.conf\u4e2d\u6dfb\u52a0:
\u3000\u3000\u3000\u3000LoadModule fastcgi_module modules\/mod_fastcgi-2.4.2-AP20.dll
\u3000\u3000\u3000\u3000# \u4f7f\u7528\u5916\u90e8FastCGI\u670d\u52a1\u5668\uff0c\u8bf7\u53c2\u8003 FastCGI \u6587\u6863\u3002
\u3000\u3000\u3000\u3000FastCgiExternalServer "c:\/php\/php-cgi.exe" -socket "php-fcgi"
\u3000\u3000\u6ce8\u610f\uff1a-socket\u53c2\u6570\u540e\u7684\u503c\u5fc5\u987b\u4e0eHKEY_LOCAL_MACHINE:Software\\FASTCGI\\.php\u4e2dBindPath\u7684\u503c\u4e00\u81f4\uff0c\u8fd9\u6837\u4e24\u4e2aFastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\u624d\u4f1a\u4f7f\u7528\u540c\u4e00\u4e2a\u547d\u540d\u7ba1\u9053\u8fde\u63a5php-cgi.exe\u3002<\/p>\n

\u3000\u3000\u6ce8\u610f\uff1a\u6b64\u914d\u7f6e\u4e2dphp-cgi.exe\u8fdb\u7a0b\u53ea\u53d7IIS\u4e2d\u7684FastCGI\u8fdb\u7a0b\u7ba1\u7406\u5668\u7ba1\u7406\uff0c Apache\u7684\u7e41\u5fd9\u8bf7\u6c42\u5e76\u4e0d\u4f1a\u4f7fIIS\u4e2d\u7684FastCGI\u8c03\u5ea6\u66f4\u591a\u7684php-cgi.exe\u8fdb\u7a0b\u3002\u56e0\u6b64\uff0c\u5728IIS\u4e2d\u914d\u7f6eFastCGI\u65f6\u5e94\u5f53\u4f7f StartServers\u503c\u8db3\u591f\u5927\uff0c\u4ee5\u907f\u514dphp\u89e3\u91ca\u5668\u6570\u91cf\u4e0d\u8db3\u3002\u540c\u6837\u5e26\u6765\u7684\u95ee\u9898\u662f\uff0c\u5982\u679cIIS\u5173\u95ed\u4e86\uff0c\u90a3\u4e48Apache\u5c31\u4f1a\u627e\u4e0d\u5230Php\u89e3\u91ca\u5668\u4e86\uff0c\u8fd9\u4e2a\u8981\u7559\u5fc3\u3002<\/p>\n

\u3000\u3000\u7531\u6b64\u5e26\u6765\u7684\u4e00\u4e2a\u95ee\u9898\u662f\uff1a\u6b64\u65f6\u7684php.ini\u4e2dcgi.force_redirect\u3001fastcgi.impersonate\u3001cgi.rfc2616_headers\u5e94\u8be5\u600e\u4e48\u8bbe\u5b9a\u5462\uff1f\u8fd9\u4e2a\u7559\u7ed9\u5927\u5bb6\u53bb\u601d\u8003\u5427\u2026\u2026\u5475\u5475<\/p>\n

\u3000\u3000\u53e6\u5916\u4e00\u4e2a\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u662f\uff0cIIS\u975e\u5e38\u7a7a\u95f2\uff0c\u4e00\u6bb5\u65f6\u95f4\u540e\u7531IIS\u542f\u52a8\u7684php-cgi.exe\u9000\u51fa\u4e86\uff0c\u5219apache\u5c31\u89e3\u91ca\u4e0d\u4e86 Php\u4e86\uff0c\u600e\u4e48\u529e\u5462\uff1f\u8fd9\u65f6\u53ef\u4ee5\u8bbf\u95ee\u4e00\u4e0biis\u7f51\u7ad9\uff0cphp-cgi.exe\u5c31\u53c8\u8d77\u6765\u4e86\uff0c\u6655\u54e6\u3002\u4e00\u4e2a\u5efa\u8bae\u662f\u4f7f\u7528IIS 6\u7684\u8fdb\u7a0b\u6c60\u7ba1\u7406\uff0c\u5728\u5e94\u7528\u7a0b\u5e8f\u6c60\u4e2d\u5173\u6389\u201c\u7a7a\u95f2\u8d85\u65f6\u201d\uff0c\u5e76\u4e14\uff0c\u5728\u201c\u5e94\u7528\u7a0b\u5e8f\u6c60\u6807\u8bc6\u201d\u4e2d\u5c06\u8fd0\u884c\u8d26\u53f7\u8bbe\u5b9a\u4e3a\u4e0eApache\u670d\u52a1\u542f\u52a8\u8d26\u53f7\u4e00\u81f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

        Windows \u4e0b\u6709\u4e24\u79cd\u65b9\u6cd5\u4f7f PHP \u5de5\u4f5c\u4e8e Apache 2.0.x \u4e4b\u4e2d\u3002\u4e00\u79cd\u662f \u4f7f\u7528 CGI \u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u53e6\u4e00\u79cd\u662f\u9002\u7528 Apache \u6a21\u5757\u7684 DLL\u3002                       
\u8fd9\u4e24\u79cd\u5de5\u4f5c\u65b9\u5f0f\u7684\u5b89\u88c5\uff1a<\/p>\n

PHP \u5728 Apache 2.0 \u4e2d\u7684 CGI \u65b9\u5f0f
ScriptAlias \/php\/ "c:\/php\/"
AddType application\/x-httpd-php .php<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1017"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1017"}],"version-history":[{"count":0,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1017\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}