mac下安装php环境的方法:首先通过命令“sudo apachectl start”启动Apache服务;然后打开“httpd.conf”文件并取消“php5_module”前的注释符号;最后通过phpinfo进行测试即可。
推荐:《PHP视频教程》
最近在试着将 showdoc 配置到自己服务器上,需要 PHP 环境,所以自己配置了一下,这里将方法记录一下。
Mac 系统下是自带 Apache 服务的,只需要开启即可,下面是几个 Apache 服务的常用命令。
/* 启动 Apache 服务 */ sudo apachectl start /* 重启 Apache 服务 */ sudo apachectl restart /* 停止 Apache 服务 */ sudo apachectl stop /* 查看 Apache 版本 */ httpd -v复制代码
sudo apachectl start
/Library/WebServer/Documents复制代码
注意: 你的 Mac 下如果装有 Server 这个软件要卸载掉(图标是蓝色地球的那个),否则输入 http://localhost 会显示 Server 的信息会冲突,具体原因我没去管,有兴趣的可以了解一下。
立即学习“PHP免费学习笔记(深入)”;
Mac 系统下也是自带 PHP 环境的,只要将其打开即可,如果想另外自行安装的话,就自己去搜一下吧。
/etc/apache2/httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so复制代码
sudo apachectl restart复制代码
/Library/WebServer/Documents复制代码
<?php phpinfo(); ?>
这里配置的是 Mac 系统自带的 PHP 环境,想另外安装的就自己去搜一下吧。
以上就是mac下如何安装php环境的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号