Home>Article>Backend Development> How to perfectly install PHP7 on Mac system

How to perfectly install PHP7 on Mac system

醉折花枝作酒筹
醉折花枝作酒筹 forward
2021-05-18 09:46:03 2272browse

This article will introduce to you how to perfectly install PHP7 on Mac system. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to perfectly install PHP7 on Mac system

Use the third-party package homebrew to install, which is very fast and effective!

Installation tutorial:

1. Start Apache

First we start the Apache service that comes with the system.
Open Terminal and enter the following command:

// 开启Apache服务 sudo apachectl start // 查看Apache版本号 sudo apachectl -v

图 Terminal输入命令打开apache服务及查看版本号

Then we verify whether the apache service we opened can be used, open the browser and enter:

http://localhost

Run PHP

Before running our php, we need to change our php configuration file, open Finder, "Go->Go to Folder...", enter:

/etc/apache2/

Find us httpd.conf configuration file:

How to perfectly install PHP7 on Mac system

Use a text editor to uncomment the following line:

LoadModule php7_module libexec/apache2/libphp7.so

How to perfectly install PHP7 on Mac system

After modifying the configuration file, we only need to restart our Apache service for the modification to take effect. Enter in Terminal:

sudo apachectl restart

Next we want to know the version of php on our Mac.

We enter in Terminal:

// 在Apache的根目录下复制index.html.en文件并重命名为info.php。 sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php

Open our info.php file, use a text editor to add after "It works":

Then restart our Apache.

After restarting, we enter in the browser URL bar:

http://localhost/info.php

How to perfectly install PHP7 on Mac system

Recommended learning:php video tutorial

The above is the detailed content of How to perfectly install PHP7 on Mac system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete