{"id":436,"date":"2020-01-10T01:44:06","date_gmt":"2020-01-09T17:44:06","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=436"},"modified":"2020-01-10T01:44:06","modified_gmt":"2020-01-09T17:44:06","slug":"windows%e7%8e%af%e5%a2%83%e4%b8%8b%e9%85%8d%e7%bd%aeapachephp","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=436","title":{"rendered":"Windows\u73af\u5883\u4e0b\u914d\u7f6eApache+PHP"},"content":{"rendered":"<h3>\u4e0b\u8f7dApache<\/h3>\n<p>\u5b98\u7f51\uff1a<a href=\"http:\/\/httpd.apache.org\" title=\"http:\/\/httpd.apache.org\">http:\/\/httpd.apache.org<\/a><\/p>\n<p>\u63a8\u8350\uff1a\u76f4\u63a5\u70b9\u51fb\u8fd9\u4e2a\u94fe\u63a5\u4e0b\u8f7d32\u4f4d\u76842.4\u7248\u672c\u3002<br \/>\n<a href=\"https:\/\/www.apachehaus.com\/downloads\/httpd-2.4.41-o111c-x86-vc15-r2.zip\" title=\"https:\/\/www.apachehaus.com\/downloads\/httpd-2.4.41-o111c-x86-vc15-r2.zip\">https:\/\/www.apachehaus.com\/downloads\/httpd-2.4.41-o111c-x86-vc15-r2.zip<\/a><br \/>\n\u89e3\u538b\u5230\u67d0\u4e2a\u5730\u65b9\u5373\u53ef\uff0c\u6211\u8fd9\u91cc\u89e3\u538b\u5230\u4e86<code>D:\\Program Files\\Apache24<\/code>\u3002<\/p>\n<h3>\u4e0b\u8f7dPHP<\/h3>\n<p>\u5b98\u7f51\uff1a<a href=\"http:\/\/php.net\/downloads.php\" title=\"http:\/\/php.net\/downloads.php\">http:\/\/php.net\/downloads.php<\/a><br \/>\n\u4e00\u5b9a\u8981\u4e0b\u8f7d <code>Thread Safe<\/code>\u7248\u672c\uff0c\u56e0\u4e3a<code>Non Thread Safe<\/code>\u7248\u672c\u6ca1\u6709<code>php7apache2_4.dll<\/code>\u3002<\/p>\n<p>\u63a8\u8350\uff1a\u76f4\u63a5\u70b9\u51fb\u8fd9\u4e2a\u94fe\u63a5\u4e0b\u8f7d32\u4f4d\u76847.3\u7248\u672c\u3002<br \/>\n<a href=\"https:\/\/windows.php.net\/downloads\/releases\/php-7.3.13-Win32-VC15-x86.zip\" title=\"https:\/\/windows.php.net\/downloads\/releases\/php-7.3.13-Win32-VC15-x86.zip\">https:\/\/windows.php.net\/downloads\/releases\/php-7.3.13-Win32-VC15-x86.zip<\/a><\/p>\n<p>32\u4f4d\u7684 Apache \u548c PHP \u4e5f\u53ef\u4ee5\u572864\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0cApache \u548c PHP \u7684\u4f4d\u6570\u8981\u76f8\u540c\uff0c\u5426\u5219\u540e\u9762\u53ef\u80fd\u4f1a\u51fa\u73b0\u9519\u8bef\u3002<br \/>\nApache \u548c PHP \u7684\u89e3\u538b\u76ee\u5f55\u6700\u597d\u4e0d\u8981\u542b\u6709\u4e2d\u6587\u3002<br \/>\n\u5c06 PHP \u89e3\u538b\u5230\u67d0\u4e2a\u5730\u65b9\uff0c\u6211\u8fd9\u91cc\u89e3\u538b\u5230\u4e86<code>D:\\Program Files\\php-7.3.13<\/code><\/p>\n<h3>\u914d\u7f6eApache<\/h3>\n<p>\u7f16\u8f91 <code>D:\\Program Files\\Apache24\\conf<\/code> \u6587\u4ef6\u5939\u4e0b\u7684<code>httpd.conf<\/code><br \/>\n1. \u5c06<code>Define SRVROOT<\/code>\u4fee\u6539\u6210Apache\u7684\u6839\u76ee\u5f55<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1001.jpg\" alt=\"\" \/><br \/>\n2. \u4fee\u6539\u7aef\u53e3\u53f7\u4e3a\u4f60\u559c\u6b22\u7684\u6570<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1006.jpg\" alt=\"\" \/><br \/>\n3. \u627e\u5230 mod_ssl.so \uff0c\u628a\u5b83\u6ce8\u91ca\u6389\u3002\u6216\u8005\u53bb<code>Apache24\\conf\\extra\\httpd-ahssl.conf<\/code>\u8fd9\u4e2a\u6587\u4ef6\u91cc\u628aSSL\u7684\u7aef\u53e3\u53f7\u6539\u6389\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\u548c\u7b2c\u4e09\u6b65\u90fd\u4e0d\u662f\u5fc5\u505a\u7684\uff0c\u4f46\u662f\u5efa\u8bae\u5927\u5bb6\u64cd\u4f5c\u4e00\u4e0b\u3002<br \/>\n\u5728apache\u7684bin\u76ee\u5f55\u4e0b\u9762\u7528\u7ba1\u7406\u5458\u6743\u9650\u6267\u884c\u547d\u4ee4<code>httpd.exe -k install<\/code><br \/>\n\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0cWindows\u7684\u670d\u52a1\u91cc\u4f1a\u51fa\u73b0\u4e00\u4e2a\u540d\u4e3a<code>Apache2.4<\/code>\u7684\u670d\u52a1\u3002<br \/>\n\u5982\u679c\u5b89\u88c5\u670d\u52a1\u5931\u8d25\uff0c\u590d\u5236\u5931\u8d25\u4fe1\u606f\u7136\u540e\u767e\u5ea6\u4e00\u4e0b\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/\u4f60\u4e3a\u4ec0\u4e48\u4e0d\u95ee\u95ee\u795e\u5947\u6d77\u87ba\u5462.jpg\" alt=\"\" \/><\/p>\n<p>\u8fd0\u884c <code>ApacheMonitor.exe<\/code>\uff0c\u70b9\u51fb start\uff0c\u5982\u679c\u5931\u8d25\uff0c\u8bf7\u7528\u7ba1\u7406\u5458\u6743\u9650\u6267\u884c\u547d\u4ee4<code>httpd -k start<\/code>\uff0c\u7136\u540e\u590d\u5236\u9519\u8bef\u4fe1\u606f\uff0c\u767e\u5ea6\u4e00\u4e0b\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/\u5176\u5b9e\u5b83\u4e00\u4e2a\u87ba\u4e5f\u4e0d\u61c2\u8fd9\u4e9b.jpg\" alt=\"\" \/><br \/>\n\u5982\u679c\u6ca1\u5931\u8d25\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee<code>localhost:\u4f60\u7684\u7aef\u53e3\u53f7<\/code>\uff08\u7aef\u53e3\u53f7\u5982\u679c\u662f80\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee<code>localhost<\/code>\uff09\uff0c\u770b\u5230\u9875\u9762\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<h3>\u914d\u7f6ePHP<\/h3>\n<p>\u6253\u5f00php\u7684\u6839\u76ee\u5f55\uff0c\u590d\u5236\u4e00\u4e2a<code>php.ini-production<\/code>\uff0c\u547d\u540d\u4e3a<code>php.ini<\/code><br \/>\n\u7f16\u8f91<code>php.ini<\/code><br \/>\n1. \u628a<code>; On windows:<\/code>\u4e0b\u9762\u4e00\u884c\u7684<code>extension_dir<\/code>\u7684\u6ce8\u91ca\u53bb\u6389\u3002<br \/>\n2. \u628a\u5e38\u7528\u7684\u6269\u5c55\u524d\u9762\u7684\u6ce8\u91ca\u90fd\u53bb\u6389\uff0c\u4f8b\u5982<code>extension=mysqli<\/code><\/p>\n<h3>\u7ee7\u7eed\u914d\u7f6eApache<\/h3>\n<p>\u7f16\u8f91 <code>D:\\Program Files\\Apache24\\conf<\/code> \u6587\u4ef6\u5939\u4e0b\u7684<code>httpd.conf<\/code><br \/>\n1. \u67e5\u627eLoadModule\uff0c\u5728\u5176\u540e\u9762\u589e\u52a0\u4e0b\u9762\u914d\u7f6e\u3002\u4fee\u6539\u4e3a\u4f60\u5bf9\u5e94\u7684\u8def\u5f84\u3002<\/p>\n<pre><code class=\"language-txt line-numbers\">LoadModule php7_module \"D:\\Program Files\\php-7.3.13\\php7apache2_4.dll\"\nPHPIniDir \"D:\\Program Files\\php-7.3.13\"\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1002.jpg\" alt=\"\" \/><br \/>\n2. \u67e5\u627eDirectoryIndex\uff0c\u914d\u7f6e\u9996\u9875\u7684\u547d\u540d\u3002<br \/>\n\u52a0\u5165index.php\uff0c\u5982\u679c\u5e0c\u671bindex.php\u4f18\u5148\u7ea7\u9ad8\u4e8eindex.html\uff0c\u5219\u5c06\u5176\u653e\u5728\u524d\u9762\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1004.jpg\" alt=\"\" \/><br \/>\n3. \u67e5\u627eAddType\uff0c\u52a0\u5165\u5982\u4e0b\u914d\u7f6e<\/p>\n<pre><code class=\"language-txt line-numbers\">AddType application\/x-httpd-php .php\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1003.jpg\" alt=\"\" \/><\/p>\n<p>\u91cd\u65b0\u542f\u52a8 Apache \uff0c\u770b\u80fd\u4e0d\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002<\/p>\n<h3>\u6d4b\u8bd5<\/h3>\n<p>\u5728<code>D:\\Program Files\\Apache24\\htdocs<\/code>\u4e0b\u521b\u5efa\u6587\u4ef6<code>index.php<\/code>\uff0c\u5185\u5bb9\u5982\u4e0b\u3002<\/p>\n<pre><code class=\"language-php line-numbers\">&lt;?php\necho \"&lt;a href='http:\/\/www.guanhaobo.cn'&gt;\u5173\u6d69\u535a\u7684\u4e2a\u4eba\u7f51\u7ad9&lt;\/a&gt;\";\n?&gt;\n<\/code><\/pre>\n<p>\u542f\u52a8 Apache \uff0c\u8bbf\u95ee<code>localhost:\u7aef\u53e3\u53f7<\/code>\uff0c\u51fa\u73b0\u4e0b\u9762\u7684\u754c\u9762\u5219\u8868\u793a\u6210\u529f\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1007.jpg\" alt=\"\" \/><br \/>\n\u8fd9\u65f6\uff0c\u522b\u7684\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u4f60\u7684 <code>IP\u5730\u5740:\u7aef\u53e3\u53f7<\/code>\u8bbf\u95ee\u4f60\u7684\u9875\u9762\uff0880\u7aef\u53e3\u5219\u4e0d\u5fc5\u52a0\u7aef\u53e3\u53f7\uff09\uff0c\u5982\u4e0b\u56fe\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/01\/1008.jpg\" alt=\"\" \/><br \/>\n\u81ea\u5df1\u53ef\u4ee5\u8bbf\u95ee\uff0c\u4f46\u522b\u4eba\u8bbf\u95ee\u4e0d\u4e86\u600e\u4e48\u529e\uff1f<br \/>\n1. \u5982\u679c\u662f\u5c40\u57df\u7f51IP\uff0c\u8bf7\u9996\u5148\u68c0\u67e5\u4f60\u4eec\u662f\u5426\u5728\u540c\u4e00\u5c40\u57df\u7f51\u5185\u3002<br \/>\n2. \u5927\u578b\u5c40\u57df\u7f51\uff0c\u6bd4\u5982\u6821\u56ed\u7f51\uff0c\u53ea\u6709\u540c\u4e00\u7f51\u6bb5\u53ef\u4ee5\u8bbf\u95ee\u4f60\u3002<br \/>\n3. \u68c0\u67e5\u7535\u8111\u8bbe\u7f6e\uff0c\u9632\u706b\u5899\u662f\u5426\u5141\u8bb8\u522b\u4eba\u8bbf\u95ee\u4f60\u7684\u7aef\u53e3\u3002\u4e91\u670d\u52a1\u5668\u8bf7\u4e0a\u670d\u52a1\u5546\u7684\u7ba1\u7406\u9875\u9762\uff0c\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u5f00\u653e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u8f7dApache \u5b98\u7f51\uff1ahttp:\/\/httpd.apache.org \u63a8\u8350\uff1a\u76f4\u63a5\u70b9\u51fb\u8fd9\u4e2a\u94fe\u63a5\u4e0b\u8f7d32\u4f4d\u76842. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[24,31],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-note","tag-php","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=436"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}