在Mac OS 10.6(Snow Leopard),10.7(Lion),10.8(Mountain Lion)上激活PHP和MySQL的最简单方法是什么?
What is the easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mountain Lion)?
我希望先使用任何捆绑版本,然后再从PHP或MySQL网站下载.那也排除了MAMP和类似的东西.
I'd prefer to use any bundled versions before resorting to downloading from the PHP or MySQL websites. That also rules out MAMP and similar.
我对终端中的命令行感到很舒服.
I'm comfortable at the command line in Terminal.
推荐答案打开一个好的文本编辑器(我建议使用TextMate,但是免费的TextWrangler或vi或nano也可以这样做),然后打开:
Open a good text editor (I'd recommend TextMate, but the free TextWrangler or vi or nano will do too), and open:
/etc/apache2/httpd.conf查找行:
"#LoadModule php5_module libexec/apache2/libphp5.so"然后取消注释(删除#).
And uncomment it (remove the #).
从mysql下载并安装最新的MySQL版本.为Intel选择x86_64版本(除非您的Intel Mac是不是64位芯片的原始Macbook Pro或Macbook.在这种情况下,请使用32位x86版本).
Download and install the latest MySQL version from mysql. Choose the x86_64 version for Intel (unless your Intel Mac is the original Macbook Pro or Macbook, which are not 64 bit chips. In those cases, use the 32 bit x86 version).
安装所有MySQL组件.使用首选窗格,启动MySQL.
Install all the MySQL components. Using the pref pane, start MySQL.
在共享系统偏好设置中,打开(或如果已打开,则关闭/打开)Web共享.
In the Sharing System Pref, turn on (or if it was already on, turn off/on) Web Sharing.
您现在应该运行Apache/PHP/MySQL.
You should now have Apache/PHP/MySQL running.
在10.4和10.5中,必须修改php.ini文件以指向mysql.sock的正确位置.有报告说,此问题已在10.6中修复,但考虑到以下一些评论,对于我们所有人来说并非如此.
In 10.4 and 10.5 it was necessary to modify the php.ini file to point to the correct location of mysql.sock. There are reports that this is fixed in 10.6, but that doesn't appear to be the case for all of us, given some of the comments below.
更多推荐
在Mac OS 10.6(Snow Leopard),10.7(Lion),10.8(Mountain Lion)上激活PHP和MySQL的最简单方法?
发布评论