{"id":2160,"date":"2018-06-11T17:49:09","date_gmt":"2018-06-11T09:49:09","guid":{"rendered":"https:\/\/www.aoisnow.net\/blog\/?p=2160"},"modified":"2018-06-11T17:49:09","modified_gmt":"2018-06-11T09:49:09","slug":"day-10840-apache%e3%80%81php-nts%e4%b8%8erewrite","status":"publish","type":"post","link":"https:\/\/www.aoisnow.net\/blog\/archives\/2160","title":{"rendered":"Day 4514 Apache\u3001PHP NTS\u3001FastCGI\u4e0eRewrite\u4e4b\u95f4\u4e0d\u5f97\u4e0d\u8bf4\u7684\u6545\u4e8b\uff08\u96fe"},"content":{"rendered":"<p>\u4e3a\u5355\u4f4d\u88c5\u65b0\u7f51\u7ad9\uff0c\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0c\u73af\u5883\u9700\u8981\u7531\u6211\u81ea\u884c\u914d\u7f6e\uff0c\u4e8e\u662f\u6309\u7167\u5f00\u53d1\u516c\u53f8\u7684\u8981\u6c42\u53bb\u4e0b\u8f7d\u4e86Apache 2.4\u3001PHP 5.6\u548cMySQL\uff0c\u7531\u4e8e\u670d\u52a1\u5668\u7cfb\u7edf\u4e3a64\u4f4dWindows\uff0c\u6240\u4ee5\u7406\u6240\u5f53\u7136\u5730\u90fd\u4e0b\u8f7d\u4e8664\u4f4d\u7684\u7ec4\u4ef6\uff0c\u5176\u4e2dPHP\u4f7f\u7528\u4e86\u6bd4\u8f83\u987a\u624b\u7684TS\uff08\u7ebf\u7a0b\u5b89\u5168\uff0cThread-safe\uff09\u7248\u672c\u3002<\/p>\n<p>\u4e00\u5207\u914d\u7f6e\u597d\u540e\uff0c\u53d1\u73b0\u8bf4\u660e\u4e66\u4e2d\u7ec4\u4ef6\u8981\u6c42\u6709\u4e00\u4e2aZend Guard Loader\uff0c\u4e8e\u662f\u8dd1\u53bb\u4e0b\u8f7d\uff0c\u4f46\u5f53\u770b\u5230\u652f\u6301PHP 5.6\u7684Zend Guard Loader\u7684\u7248\u672c\u53ea\u6709x86\u7248\u672c\u65f6\u5fc3\u91cc\u5c31\u54af\u5654\u4e00\u4e0b\uff0c\u5c1d\u8bd5\u914d\u7f6e\u540e\uff0c\u679c\u4e0d\u5176\u7136\uff0c64\u4f4d\u7684PHP\u65e0\u6cd5\u4e0e32\u4f4d\u7684Zend\u7ec4\u4ef6\u534f\u4f5c\uff0c\u4e0d\u5f97\u5df2\u63a8\u5012\u91cd\u6765\uff0c\u8c01\u77e5\u8fd9\u53ea\u662f\u66f4\u5927\u5751\u7684\u5f00\u59cb\u3002<!--more--><\/p>\n<p>\u5c06Apache 2.4\u548cPHP 5.6 Non Thread-Safe\u7684\u6587\u4ef6\u51c6\u5907\u597d\u540e\uff0c\u5374\u627e\u4e0d\u5230php5_apache\u90a3\u4e2adll\u5f15\u7528\uff0c\u4e00\u901a\u68c0\u7d22\u5f97\u77e5NTS\u7248\u672c\u7684PHP\u662f\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\u7684\uff0c\u9700\u8981\u91c7\u7528FastCGI\u8c03\u7528\uff0c\u4e8e\u662f\u5728httpd.conf\u4e2d\u589e\u6dfb\u5982\u4e0b\u884c\u5c06Apache\u548cPHP\u8fdb\u884c\u7ec4\u5408\uff1a<\/p>\n<blockquote><p># PHP Modules.<br \/>\nLoadModule fcgid_module modules\/mod_fcgid.so<br \/>\n&lt;IfModule fcgid_module&gt;<br \/>\nFcgidInitialEnv TEMP &#8220;C:\/WINDOWS\/Temp&#8221;<br \/>\nFcgidInitialEnv TMP &#8220;C:\/WINDOWS\/Temp&#8221;<br \/>\nFcgidInitialEnv windir &#8220;C:\/WINDOWS&#8221;<br \/>\nFcgidInitialEnv PHPRC &#8220;F:\/web\/php&#8221;<br \/>\nFcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000<\/p>\n<p>&lt;Files ~ &#8220;\\.php$&gt;&#8221;<br \/>\nAddHandler fcgid-script .php<br \/>\nFcgidWrapper &#8220;F:\/web\/php\/php-cgi.exe&#8221; .php<br \/>\nOptions ExecCGI<br \/>\nAllow from all<br \/>\n&lt;\/Files&gt;<br \/>\n&lt;\/IfModule&gt;<\/p><\/blockquote>\n<p>\u6d4b\u8bd5\u5b89\u88c5phpMyAdmin\uff0c\u4e00\u5207\u6b63\u5e38\uff0c\u4e8e\u662f\u6309\u7167\u624b\u518c\u7ee7\u7eed\u5411\u4e0b\u914d\u7f6e\uff0c\u9700\u8981\u589e\u6dfb\u4e00\u90e8\u5206Rewrite\u89c4\u5219\u6765\u652f\u6301\u7cfb\u7edf\u7684\u8fd0\u884c\uff0c\u7ed3\u679c\u8fd9\u4e9b\u89c4\u5219\u4e00\u52a0\uff0c\u8bbf\u95ee\u4efb\u4f55\u4e1c\u897f\u90fd\u662f403 Forbidden\uff0c\u8fde\u4e00\u4e2ahtml\u90fd\u8bbf\u95ee\u4e0d\u5230\u4e86\uff0c\u8bd5\u4e86\u5f88\u591a\u65b9\u6cd5\u90fd\u6ca1\u6709\u7528\uff0c\u53bb\u67e5\u770b\u65e5\u5fd7\u65f6\u53ef\u4ee5\u770b\u5230\u5f88\u591a\u5f62\u5982\u4e0b\u6587\u7684\u9519\u8bef\u4fe1\u606f\uff1a<\/p>\n<blockquote><p>[Mon Jun 11 17:39:15.291969 2018] [rewrite:error] [pid 7496:tid 896] [client &#8212;.&#8212;.&#8212;.&#8212;:&#8212;&#8211;] AH00670: <span style=\"color: #0000ff;\">Options FollowSymLinks and SymLinksIfOwnerMatch are both off<\/span>, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : D:\/web\/htdocs\/site1\/index.php<\/p><\/blockquote>\n<p>\u4f46\u662f\u65e0\u8bba\u662f\u5728httpd.conf\u8fd8\u662fvhosts\u914d\u7f6e\u4e2d\u7684\u5bf9\u5e94\u4f4d\u7f6e\uff0c\u589e\u52a0FollowSymLinks\u6216SymLinksIfOwnerMatch\u7684Options\u90fd\u6ca1\u6709\u7528\u3002<\/p>\n<p>\u5728\u6298\u817e\u4e86\u4e00\u4e2a\u591a\u5c0f\u65f6\u540e\uff0c\u7ec8\u4e8e\u53d1\u73b0\u4e86\u4e00\u4e2a\u6709\u7528\u7684\u65b9\u6cd5\uff08<a href=\"https:\/\/stackoverflow.com\/questions\/11901993\/options-followsymlinks-or-symlinksifownermatch-is-off\" target=\"_blank\" rel=\"noopener\">\u539f\u6587\u94fe\u63a5<\/a>\uff09\uff1a<\/p>\n<blockquote><p>\u5728FastCGI\u914d\u7f6e\u5757\u4e2d\uff0c\u9700\u8981\u5c06\u5bf9*.php\u6587\u4ef6\u7684\u5904\u7406\u914d\u7f6e\u589e\u52a0\uff08\u6216\u4fee\u6539\u4e3a\uff09\u5982\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n<p>Options ExecCGI\u00a0<span style=\"color: #ff0000;\"><strong>FollowSymLinks<\/strong><\/span><\/p><\/blockquote>\n<p>\u636e\u8bf4\u662f\u56e0\u4e3aFastCGI\u7684\u914d\u7f6e\u662f\u4e0eTS\u7684PHP\u4e0d\u540c\u9020\u6210\u7684\u3002<\/p>\n<p>\u91cd\u542f\u670d\u52a1\uff0c\u7ec8\u4e8e\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u5355\u4f4d\u88c5\u65b0\u7f51\u7ad9\uff0c\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0c\u73af\u5883\u9700\u8981\u7531\u6211\u81ea\u884c\u914d\u7f6e\uff0c\u4e8e\u662f\u6309\u7167\u5f00\u53d1\u516c\u53f8\u7684\u8981\u6c42\u53bb\u4e0b\u8f7d\u4e86Apache 2.4\u3001PHP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2160","post","type-post","status-publish","format-standard","hentry","category-sketch"],"_links":{"self":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/2160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/comments?post=2160"}],"version-history":[{"count":0,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/2160\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/media?parent=2160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/categories?post=2160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/tags?post=2160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}