Mac 开启php7服务

mac自带Apache 和 php服务,打开就好,非常方便
1.打开apache服务

sudo apachectl start

2.替换自己的文件夹

sudo vi /etc/apache2/httpd.conf
搜索:/Directory


DocumentRoot “/Library/WebServer/Documents”
<Directory “/Library/WebServer/Documents”>
替换成
DocumentRoot “/Users/xxx/server”
<Directory “/Users/xxx/server”>

3.建个index.html,测试127.0.0.1,没问题进入下一步

123456

4.编辑httpd.conf文件
搜索/php

将#LoadModule php7_module libexec/apache2/libphp7.so前面的#去掉.

搜索index.html,添加index.php,修改如下

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

5.建个index.php测试127.0.0.1

<?phpphpinfo();?>

如果显示如下页面,则大功告成

PHP Version 7.3.24-(to be removed in future macOS)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值