您如何在Mac OS X上使用php? [英] How do you get php working on Mac OS X?
问题描述
我最近更新到Lion,并在系统偏好设置"中启用了"Web共享",但是我无法使php正常工作.
I have recently updated to Lion and enabled Web Sharing in the System Preferences but I am unable to get php working.
我在Web根目录中添加了一个信息文件,它以文本形式输出该文件.
I added an info file to the web root directory and it outputs the file as text.
info.php
with the content
<?php phpinfo(); ?>
推荐答案
(此方法似乎适用于10.9(小牛),10.10(优胜美地)和10.11(埃尔卡皮坦),所以我想我提到了对于任何稍微受挫的OS X更新程序:D)
( This method appears to work fine for 10.9 (Mavericks), 10.10 (Yosemite) and 10.11 (El Capitan), so I figured I'd mention that for any new influx of slightly frustrated OS X updaters :D )
编辑您的/etc/apache2/httpd.conf并确保该行:
Edit your /etc/apache2/httpd.conf and make sure the line:
LoadModule php5_module libexec/apache2/libphp5.so
...存在.我认为默认情况下,在标准的OS X配置中已将其注释掉,但是根据我的记忆,您只需要取消注释,然后重新启动Apache:
...exists. I think it's commented out by default in the standard OS X config, but from what I remember, you just need to uncomment it, then re-start Apache:
sudo apachectl restart
你应该很好.
这篇关于您如何在Mac OS X上使用php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!