赞
踩
$ sudo apachectl start
浏览器访问 http://localhost 确认 Apache 启动成功
终端运行命令,备份 Apache 配置文件
$ cd /etc/apache2/
$ sudo cp httpd.conf httpd.conf.bak
$ sudo vim httpd.conf
DocumentRoot "/Users/wangyuanyuan/Documents/MacDev/Sites"
<Directory "/Users/wangyuanyuan/Documents/MacDev/Sites">
Options Indexes FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
User wangyuanyuan
Group staff
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
$ cd Documents/MacDev/Sites/
$ cp /Library/WebServer/Documents/* ./
$ rm index.*
$ touch index.php
$ echo "<h1>My User Web Root</h1> <hr> <?php phpinfo(); ?>" > index.php
$ sudo apachectl -k restart
参考:
macOS 10.12 Sierra Apache Setup: Multiple PHP Versions
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。