Open Terminal and enter the following command:
// 开启Apache服务 sudo apachectl start // 查看Apache版本号 sudo apachectl -v
http://localhost
Related learning recommendations:Running PHPBefore running our php, we need to change our php Configuration file, open Finder, "Go -> Go to Folder...", enter:
/etc/apache2/
LoadModule php7_module libexec/apache2/libphp7.so
We enter in Terminal:
sudo apachectl restart
// 在Apache的根目录下复制index.html.en文件并重命名为info.php。 sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php
After restarting, we enter in the browser URL bar:
<?php phpinfo(); ?>
Open Terminal and enter the following command:
http://localhost/info.php
// 开启Apache服务 sudo apachectl start // 查看Apache版本号 sudo apachectl -v
Before running our php, we need to change our php configuration file, open Finder, "Go->Go to Folder...", enter:
http://localhost
/etc/apache2/
Configuration After the file is modified, we only need to restart our Apache service for the modification to take effect. Enter in Terminal:
LoadModule php7_module libexec/apache2/libphp7.so
Next we want to know the version of php on our Mac.
We enter in Terminal:sudo apachectl restart
// 在Apache的根目录下复制index.html.en文件并重命名为info.php。 sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php
and then restart our Apache again.
After restarting, we enter in the browser URL bar:<?php phpinfo(); ?>
The above is the detailed content of Learn the detailed tutorial to perfectly install PHP7 on Mac system. For more information, please follow other related articles on the PHP Chinese website!