{"id":54291,"date":"2024-10-09T18:12:17","date_gmt":"2024-10-09T10:12:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/54291\/"},"modified":"2024-10-09T18:12:17","modified_gmt":"2024-10-09T10:12:17","slug":"windows-%e4%b8%8b-apache-mysql-php-%e9%81%8b%e8%a1%8c%e7%92%b0%e5%a2%83%e7%9a%84%e5%ae%89%e8%a3%9d%e5%9c%96%e6%96%87%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/54291\/","title":{"rendered":"Windows \u4e0b Apache + MySQL + PHP \u904b\u884c\u74b0\u5883\u7684\u5b89\u88dd\u5716\u6587\u65b9\u6cd5"},"content":{"rendered":"<h1 id=\"windows-%e4%b8%8b-apache-mysql-php-%e9%81%8b%e8%a1%8c%e7%92%b0%e5%a2%83%e7%9a%84%e5%ae%89%e8%a3%9d%e5%9c%96%e6%96%87%e6%96%b9%e6%b3%95-fVEJxdEYoL\">Windows \u4e0b Apache + MySQL + PHP \u904b\u884c\u74b0\u5883\u7684\u5b89\u88dd\u5716\u6587\u65b9\u6cd5<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0cApache\u3001MySQL \u548c PHP\uff08\u901a\u5e38\u7c21\u7a31\u70ba LAMP \u5806\u758a\uff09\u662f\u6700\u53d7\u6b61\u8fce\u7684\u958b\u767c\u74b0\u5883\u4e4b\u4e00\u3002\u96d6\u7136 LAMP \u901a\u5e38\u6307\u7684\u662f Linux \u74b0\u5883\uff0c\u4f46\u5728 Windows \u7cfb\u7d71\u4e0a\u4e5f\u53ef\u4ee5\u8f15\u9b06\u5b89\u88dd\u9019\u4e9b\u7d44\u4ef6\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728 Windows \u4e0b\u5b89\u88dd Apache\u3001MySQL \u548c PHP \u7684\u6b65\u9a5f\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%80%ef%bc%9a%e5%ae%89%e8%a3%9d-apache-fVEJxdEYoL\">\u6b65\u9a5f\u4e00\uff1a\u5b89\u88dd Apache<\/h2>\n<p>Apache \u662f\u4e00\u500b\u958b\u6e90\u7684\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u80fd\u5920\u8655\u7406 HTTP \u8acb\u6c42\u4e26\u63d0\u4f9b\u7db2\u9801\u5167\u5bb9\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd Apache \u7684\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li>\u8a2a\u554f <a href=\"https:\/\/httpd.apache.org\/download.cgi\" rel=\"nofollow noopener\" target=\"_blank\">Apache \u5b98\u65b9\u7db2\u7ad9<\/a>\uff0c\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684 Apache HTTP Server\u3002<\/li>\n<li>\u904b\u884c\u4e0b\u8f09\u7684\u5b89\u88dd\u7a0b\u5f0f\uff0c\u4e26\u6309\u7167\u63d0\u793a\u9032\u884c\u5b89\u88dd\u3002\u9078\u64c7\u5b89\u88dd\u8def\u5f91\uff0c\u5efa\u8b70\u4f7f\u7528\u9ed8\u8a8d\u8def\u5f91\u3002<\/li>\n<li>\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u9078\u64c7\u300c\u670d\u52d9\u300d\u9078\u9805\uff0c\u9019\u6a23 Apache \u5c07\u4f5c\u70ba Windows \u670d\u52d9\u904b\u884c\u3002<\/li>\n<li>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u6253\u958b\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5 Apache \u670d\u52d9\uff1a<\/li>\n<\/ol>\n<pre><code>httpd -k start<\/code><\/pre>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u53ef\u4ee5\u5728\u700f\u89bd\u5668\u4e2d\u8f38\u5165 <code>http:\/\/localhost<\/code>\uff0c\u61c9\u8a72\u80fd\u770b\u5230 Apache \u7684\u6b61\u8fce\u9801\u9762\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%ba%8c%ef%bc%9a%e5%ae%89%e8%a3%9d-mysql-fVEJxdEYoL\">\u6b65\u9a5f\u4e8c\uff1a\u5b89\u88dd MySQL<\/h2>\n<p>MySQL \u662f\u4e00\u500b\u6d41\u884c\u7684\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\u3002\u5b89\u88dd MySQL \u7684\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u8a2a\u554f <a href=\"https:\/\/dev.mysql.com\/downloads\/mysql\/\" rel=\"nofollow noopener\" target=\"_blank\">MySQL \u5b98\u65b9\u7db2\u7ad9<\/a>\uff0c\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684 MySQL Installer\u3002<\/li>\n<li>\u904b\u884c\u5b89\u88dd\u7a0b\u5f0f\uff0c\u9078\u64c7\u300cDeveloper Default\u300d\u5b89\u88dd\u985e\u578b\uff0c\u9019\u6a23\u6703\u5b89\u88dd MySQL Server \u548c\u5176\u4ed6\u5fc5\u8981\u7684\u5de5\u5177\u3002<\/li>\n<li>\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u60a8\u9700\u8981\u8a2d\u7f6e root \u5bc6\u78bc\uff0c\u8acb\u52d9\u5fc5\u8a18\u4f4f\u9019\u500b\u5bc6\u78bc\u3002<\/li>\n<li>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 MySQL Workbench \u4f86\u7ba1\u7406\u6578\u64da\u5eab\u3002<\/li>\n<\/ol>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%89%ef%bc%9a%e5%ae%89%e8%a3%9d-php-fVEJxdEYoL\">\u6b65\u9a5f\u4e09\uff1a\u5b89\u88dd PHP<\/h2>\n<p>PHP \u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u958b\u6e90\u8173\u672c\u8a9e\u8a00\uff0c\u7279\u5225\u9069\u5408\u65bc\u7db2\u9801\u958b\u767c\u3002\u5b89\u88dd PHP \u7684\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u8a2a\u554f <a href=\"https:\/\/www.php.net\/downloads\" rel=\"nofollow noopener\" target=\"_blank\">PHP \u5b98\u65b9\u7db2\u7ad9<\/a>\uff0c\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684 PHP\u3002<\/li>\n<li>\u89e3\u58d3\u7e2e\u4e0b\u8f09\u7684\u6587\u4ef6\u5230\u4e00\u500b\u76ee\u9304\uff0c\u4f8b\u5982 <code>C:php<\/code>\u3002<\/li>\n<li>\u5c07 PHP \u7684\u8def\u5f91\u6dfb\u52a0\u5230\u7cfb\u7d71\u74b0\u5883\u8b8a\u91cf\u4e2d\u3002\u53f3\u9375\u9ede\u64ca\u300c\u6b64\u96fb\u8166\u300d\uff0c\u9078\u64c7\u300c\u5c6c\u6027\u300d\uff0c\u7136\u5f8c\u9078\u64c7\u300c\u9ad8\u7d1a\u7cfb\u7d71\u8a2d\u7f6e\u300d\u4e2d\u7684\u300c\u74b0\u5883\u8b8a\u91cf\u300d\u3002\u5728\u300c\u7cfb\u7d71\u8b8a\u91cf\u300d\u4e2d\u627e\u5230\u300cPath\u300d\uff0c\u7136\u5f8c\u6dfb\u52a0 PHP \u7684\u5b89\u88dd\u8def\u5f91\u3002<\/li>\n<li>\u5728 Apache \u7684\u914d\u7f6e\u6587\u4ef6 <code>httpd.conf<\/code> \u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u78bc\uff0c\u4ee5\u4fbf Apache \u80fd\u5920\u8655\u7406 PHP \u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre><code>LoadModule php_module \"C:\/php\/php7apache2_4.dll\"\nAddType application\/x-httpd-php .php\nPHPIniDir \"C:\/php\"\n<\/code><\/pre>\n<p>\u78ba\u4fdd\u5c07\u8def\u5f91\u66ff\u63db\u70ba\u60a8\u5be6\u969b\u7684 PHP \u5b89\u88dd\u8def\u5f91\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e5%9b%9b%ef%bc%9a%e6%b8%ac%e8%a9%a6%e7%92%b0%e5%a2%83-fVEJxdEYoL\">\u6b65\u9a5f\u56db\uff1a\u6e2c\u8a66\u74b0\u5883<\/h2>\n<p>\u70ba\u4e86\u78ba\u4fdd\u4e00\u5207\u6b63\u5e38\u904b\u884c\uff0c\u60a8\u53ef\u4ee5\u5275\u5efa\u4e00\u500b\u7c21\u55ae\u7684 PHP \u6e2c\u8a66\u6587\u4ef6\uff1a<\/p>\n<ol>\n<li>\u5728 Apache \u7684\u6839\u76ee\u9304\uff08\u901a\u5e38\u662f <code>C:Program FilesApache GroupApache2htdocs<\/code>\uff09\u4e2d\u5275\u5efa\u4e00\u500b\u540d\u70ba <code>info.php<\/code> \u7684\u6587\u4ef6\u3002<\/li>\n<li>\u5728\u8a72\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u78bc\uff1a<\/li>\n<\/ol>\n<pre><code>&lt;?php\nphpinfo();\n?&gt;<\/code><\/pre>\n<p>\u7136\u5f8c\u5728\u700f\u89bd\u5668\u4e2d\u8f38\u5165 <code>http:\/\/localhost\/info.php<\/code>\uff0c\u5982\u679c\u60a8\u80fd\u770b\u5230 PHP \u7684\u914d\u7f6e\u4fe1\u606f\u9801\u9762\uff0c\u5247\u8868\u793a\u5b89\u88dd\u6210\u529f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-fVEJxdEYoL\">\u7e3d\u7d50<\/h2>\n<p>\u5728 Windows \u4e0b\u5b89\u88dd Apache\u3001MySQL \u548c PHP \u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\uff0c\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5feb\u901f\u642d\u5efa\u4e00\u500b\u5b8c\u6574\u7684\u958b\u767c\u74b0\u5883\u3002\u9019\u6a23\u7684\u74b0\u5883\u4e0d\u50c5\u9069\u5408\u5b78\u7fd2\u548c\u958b\u767c\uff0c\u4e5f\u53ef\u4ee5\u7528\u65bc\u5c0f\u578b\u9805\u76ee\u7684\u90e8\u7f72\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u9019\u6a23\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u64f4\u5c55\u60a8\u7684\u61c9\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8a73\u7d30\u5716\u6587\u6559\u5b78\uff0c\u8f15\u9b06\u5728 Windows \u4e0a\u5b89\u88dd Apache\u3001MySQL \u548c PHP\uff0c\u6253\u9020\u5b8c\u6574\u7684\u904b\u884c\u74b0\u5883\uff0c\u9069\u5408\u65b0\u624b\u8207\u9032\u968e\u7528\u6236\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-54291","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=54291"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54291\/revisions"}],"predecessor-version":[{"id":54292,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54291\/revisions\/54292"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=54291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=54291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=54291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}