首先切换到root用户 sudo -i
接着查看80端口是否被暂用 lsof
查看apache 版本? httpd -v
开启apache???? apachectl start
重启apache? apachectl restart
关闭apache? apachectl stop
运行 127.0.0.1,显示it works表示apache开启成功
编写test.php代码 test.php存放路径 /Library/WebServer/Documents 即Apache的网站服务器根目录在/Library/WebServer/Documents
需要重启apache后再 运行127.0.0.1/test.php 显示这个页面表示运行成功