Home >Backend Development >PHP Problem >How to install php environment under mac
How to install the php environment on mac: First start the Apache service through the command "sudo apachectl start"; then open the "httpd.conf" file and cancel the comment symbol before "php5_module"; finally test it through How to install php environment under mac. Can.
Recommended: "PHP Video Tutorial"
Recently trying to configure
showdoc
to my own server , it requires aPHP
environment, so I configured it myself and record the method here.
Mac
The system comes with the Apache
service, you just need to turn it on , the following are several common commands for Apache
services.
/* 启动 Apache 服务 */ sudo apachectl start /* 重启 Apache 服务 */ sudo apachectl restart /* 停止 Apache 服务 */ sudo apachectl stop /* 查看 Apache 版本 */ httpd -v复制代码
Apache
service. sudo apachectl start
It Works
appears, it means the Apache
service is started successfully. The default root directory of the website server of Apache
is in the path below. /Library/WebServer/Documents复制代码
Note: If Server
is installed on your Mac
, this software must be uninstalled (the icon is a blue globe) That), otherwise entering http://localhost will display Server
information that will conflict. I don’t care about the specific reasons. Those who are interested can learn more.
Mac
The system also comes with the PHP
environment. Just open it. If you want to do it yourself If you want to install it, just search it yourself.
Finder
,然后按下 shift + command + G
打开前往文件夹,前往以下地址:/etc/apache2/httpd.conf
httpd.conf
这个文件,找到下面这一行,然后将前面的 #
注释符去掉,然后 command + s
保存。LoadModule php5_module libexec/apache2/libphp5.so复制代码
Apache
服务。sudo apachectl restart复制代码
Finder
,然后按下 shift + command + G
打开前往文件夹,前往以下地址,这个地址是 Apache
的默认网站服务器根目录。/Library/WebServer/Documents复制代码
How to install php environment under mac.php
的文件,在里面输入以下代码后,command + s
保存。<?php How to install php environment under mac(); ?>
PHP
环境配置成功。这里配置的是
Mac
系统自带的PHP
环境,想另外安装的就自己去搜一下吧。
The above is the detailed content of How to install php environment under mac. For more information, please follow other related articles on the PHP Chinese website!