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

How to perfectly install PHP7 on Mac system

醉折花枝作酒筹
Release: 2023-02-17 22:26:02
forward
2412 people have browsed it

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
Copy after login

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

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

http://localhost
Copy after login

Run PHP

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

/etc/apache2/
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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

<?php phpinfo(); ?>
Copy after login

Then restart our Apache.

After restarting, we enter in the browser URL bar:

http://localhost/info.php
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template