{"id":1557,"date":"2014-03-29T14:20:31","date_gmt":"2014-03-29T06:20:31","guid":{"rendered":"http:\/\/www.gejoin.com\/?p=1557"},"modified":"2014-03-29T14:20:31","modified_gmt":"2014-03-29T06:20:31","slug":"mac-%e9%85%8d%e7%bd%ae%e9%83%a8%e7%bd%b2apachephpmysql","status":"publish","type":"post","link":"https:\/\/www.mujins.com\/?p=1557","title":{"rendered":"Mac OSX\u914d\u7f6e\u90e8\u7f72Apache+php+mysql"},"content":{"rendered":"<p><span style=\"line-height: 1.5em;\">Mac OSX \u7cfb\u7edf\u672c\u8eab\u5df2\u7ecf\u96c6\u6210apache\uff0cphp\uff0cperl\uff0c\u56e0\u6b64\u53ea\u8981\u66f4\u6539\u4e00\u4e9b\u914d\u7f6e\uff0c\u53e6\u5916mysql\u9700\u8981\u5b89\u88c5\u3002<\/span><\/p>\n<p><a href=\"https:\/\/www.gigiwangs.com\/wp-content\/uploads\/2014\/03\/PHP-Mysql.jpg\" data-lightbox=\"gal[1557]\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1558\" src=\"https:\/\/www.gigiwangs.com\/wp-content\/uploads\/2014\/03\/PHP-Mysql.jpg\" alt=\"PHP-Mysql\" width=\"500\" height=\"270\" \/><\/a><\/p>\n<p>1.\u542f\u52a8Apache<\/p>\n<p><span style=\"color: #ff6600;\">\u00a0 \u00a0 sudo apachectl start<\/span><\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\uff1a<span style=\"color: #ff6600;\">\/private\/etc\/apache2\/httpd.conf<br \/>\n<\/span>\u5173\u6ce8\u8fd9\u91cc\u3002\u8bbf\u95ee<a href=\"http:\/\/localhost\">http:\/\/localhost<\/a>\u7f51\u7ad9\u6839\u76ee\u5f55\uff1aindex.html.en\u9996\u9875\u6587\u4ef6\u3002<\/p>\n<p><span style=\"color: #800000;\"><strong>DocumentRoot &#8220;\/Library\/WebServer\/Documents&#8221;<\/strong><\/span><\/p>\n<p>\u6211\u7684MAC\u539f\u676510.6\uff0c\u4e00\u6b65\u4e00\u6b65\uff0810.7-10.8\uff09\u73b0\u5df2\u7ecf\u5347\u7ea7\u81f310.9.2\u7528\u6237\u76ee\u5f55\u4e0b\u672c\u8eab\u5df2\u7ecf\u5b58\u5728Sites\u76ee\u5f55\uff08\u7528\u6237\u6587\u4ef6\u76ee\u5f55\uff09\u548c\u7f51\u9875\u6587\u4ef6\u3002\u4e3a\u4e86\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u7528\u6237\u76ee\u5f55\u4e0b\u5f97\u7f51\u7ad9\u76ee\u5f55Sites\uff1a<\/p>\n<p>\u5efa\u7acb\u8f6f\u94fe\u63a5\uff1a<\/p>\n<p><span style=\"color: #ff6600;\">\u00a0 sudo ln \u2013sf\u00a0 \/Users\/wangzhe\/Sites \/Library\/WebServer\/Documents\/Sites<\/span><\/p>\n<p>\u5728httpd.conf\u00a0 \u6dfb\u52a0\uff1a<\/p>\n<p>&lt;Directory &#8220;\/Users\/wangzhe\/Sites&#8221;&gt;<br \/>\nOptions Indexes FollowSymLinks<br \/>\nAllowOverride None<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\n&lt;\/Directory&gt;<\/p>\n<p>\u6216\u8005\u5728\/private\/etc\/apache2\/httpd.conf \u52a0\u4e0a<\/p>\n<p><span style=\"color: #ff9900;\">Include \/private\/etc\/apache2\/users\/*.conf<\/span><\/p>\n<p>\u8bbf\u95ee\u51fa\u73b0\uff1a<em>403 Forbidden. <b>You don&#8217;t have permission to access \/Sites on this server.<\/b><\/em><\/p>\n<p><b><\/b><b>\u914d\u7f6e\u591a\u6b21\u4fee\u6539\u9519\u8bef\u4e00\u76f4\u5b58\u5728\u3002\u6000\u7591\u6743\u9650\u95ee\u9898\u3002<\/b>User\/wangzhe \/Sites\u00a0 \u6743\u9650\u4e3a\uff1adrw-r&#8211;r&#8211;+\u00a0 \u9700\u8981\u4fee\u6539\u4e3a755\u3002<\/p>\n<p><span style=\"color: #ff6600;\">chmod 755 User\/wangzhe \/Sites<\/span><\/p>\n<p>\u95ee\u9898\u89e3\u51b3!<\/p>\n<p>2.\u914d\u7f6ephp<\/p>\n<p>php\u914d\u7f6e\u6587\u4ef6\u5728\/etc\/php.ini\u00a0 ,\u53ef\u5c06\u539f\u6709php.default.ini \u91cd\u547d\u540d\u4e3aphp.ini<br \/>\n\u5c06\/etc\/apache2\/httpd.conf \u4e2dphp\u652f\u6301\u6ce8\u91ca\u53bb\u6389\u3002\u6d4f\u89c8\u5668\u4e2d\u6d4b\u8bd5PHP\u3002<\/p>\n<p>3.\u5b89\u88c5\u914d\u7f6e mysql \u548cphpmyadmin<\/p>\n<p>(1)\u4e0b\u8f7d<b>MySQL Community Server\u00a0 \u9009\u62e9<\/b><b>Mac OS X 10.7 (x86, 64-bit), DMG <\/b>Archive \u4e0b\u8f7d<\/p>\n<p>(2)\u5b89\u88c5mysql-5.6.17-osx10.7-x86_64.pkg \uff0cMySQLStartupItem.pkg\u4ee5\u53caMySQL.prefPane. \u5b89\u88c5\u7684\u76ee\u5f55\u5728 \/usr\/local\/mysql-5.6.17-osx10.7-x86_64<\/p>\n<p>(3)\u5efa\u7acb\u8f6f\u94fe\u63a5<\/p>\n<pre><span style=\"color: #ff6600;\">ln \u2013s \/usr\/local\/mysql-5.6.17-osx10.7-x86_64\/bin\/mysql \/usr\/local\/bin\/mysql<\/span><\/pre>\n<pre><span style=\"color: #ff6600;\">ln \u2013s \/usr\/local\/mysql-5.6.17-osx10.7-x86_64\/bin\/mysqladmin \/usr\/local\/bin\/mysqladmin<\/span><\/pre>\n<p>(4)\u542f\u52a8mysql\uff0c\u4f7f\u7528\u7cfb\u7edf\u504f\u597d\u8bbe\u7f6e\u4e2d\u7684\u53ef\u89c6\u5316\u9762\u677f\u6216\u8005\u5728\u7ec8\u7aef\u8f93\u5165:<\/p>\n<pre><span style=\"color: #ff6600;\">sudo \/usr\/local\/mysql\/support-files\/mysql.server start<\/span><\/pre>\n<p>(5) \u4fee\u6539mysql \u7528\u6237root\u5bc6\u7801<\/p>\n<pre><span style=\"color: #ff6600;\">mysqladmin -u root password \u2018passwd\u2019<\/span><\/pre>\n<p>(6)\u5b89\u88c5phpMyAdmin\uff0c\u5c06\u4e0b\u8f7dphpMyAdmin-4.1.12-english.tar.gz\u89e3\u538b\u5230:<\/p>\n<p>\/Library\/WebServer\/Documents\u4e0b,\u91cd\u547d\u540d\u4e3aphpMyAdmin\u3002<\/p>\n<p>(7) \u4fee\u6539\u914d\u7f6e\uff1a\u5c06phpMyAdmin\u4e0b\u7684config.sample.inc.php\u6587\u4ef6\u91cd\u547d\u540d\u4e3aconfig.inc.php\uff0c\u4fee\u6539<\/p>\n<p><span style=\"color: #ff6600;\">$cfg[&#8216;Servers&#8217;][$i][&#8216;host&#8217;] = &#8216;localhost&#8217;; \u5c06localhost\u4fee\u6539\u4e3a 127.0.0.1<\/span><\/p>\n<p>\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165<a href=\"http:\/\/localhost\/phpMyAdmin\/\">http:\/\/localhost\/phpMyAdmin\/<\/a> \u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u73af\u5883\u90e8\u7f72\u5b8c\u6bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mac OSX \u7cfb\u7edf\u672c\u8eab\u5df2\u7ecf\u96c6\u6210apache\uff0cphp\uff0cperl\uff0c\u56e0\u6b64\u53ea\u8981\u66f4\u6539\u4e00\u4e9b\u914d\u7f6e\uff0c\u53e6\u5916mysql\u9700\u8981\u5b89\u88c5\u3002 1.\u542f\u52a8Apache \u00a0 \u00a0 sudo apachectl start \u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\uff1a\/private\/etc\/apache2\/httpd.conf \u5173\u6ce8\u8fd9\u91cc\u3002\u8bbf\u95eehttp:\/\/localhost\u7f51\u7ad9\u6839\u76ee\u5f55\uff1aindex.html.en\u9996\u9875\u6587\u4ef6\u3002 DocumentRoot &#8220;\/Library\/WebServer\/Documents&#8221; \u6211\u7684MAC\u539f\u676510.6\uff0c\u4e00\u6b65\u4e00\u6b65\uff0810.7-10.8\uff09\u73b0\u5df2\u7ecf\u5347\u7ea7\u81f310.9.2\u7528\u6237\u76ee\u5f55\u4e0b\u672c\u8eab\u5df2\u7ecf\u5b58\u5728Sites\u76ee\u5f55\uff08\u7528\u6237\u6587\u4ef6\u76ee\u5f55\uff09\u548c\u7f51\u9875\u6587\u4ef6\u3002\u4e3a\u4e86\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u7528\u6237\u76ee\u5f55\u4e0b\u5f97\u7f51\u7ad9\u76ee\u5f55Sites\uff1a \u5efa\u7acb\u8f6f\u94fe\u63a5\uff1a \u00a0 sudo ln \u2013sf\u00a0 \/Users\/wangzhe\/Sites \/Library\/WebServer\/Documents\/Sites \u5728httpd.conf\u00a0 \u6dfb\u52a0\uff1a &lt;Directory &#8220;\/Users\/wangzhe\/Sites&#8221;&gt; Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all &lt;\/Directory&gt; \u6216\u8005\u5728\/private\/etc\/apache2\/httpd.conf \u52a0\u4e0a Include \/private\/etc\/apache2\/users\/*.conf \u8bbf\u95ee\u51fa\u73b0\uff1a403 Forbidden. You don&#8217;t have permission to access \/Sites on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1558,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[19,45,31,4,8],"tags":[71],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/wp\/v2\/posts\/1557"}],"collection":[{"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mujins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1557"}],"version-history":[{"count":0,"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/wp\/v2\/posts\/1557\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mujins.com\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/www.mujins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mujins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mujins.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}