Home > Backend Development > PHP7 > body text

Detailed tutorial on installing PHP7 under OSX

藏色散人
Release: 2023-02-17 14:06:01
forward
2761 people have browsed it

Content summary

1. Install homebrew

2. Install php7 through homebrew

3. Configure apache file

4. Restart apache

Install homebrew

homebrew is the best package management software under OSX (no one), and it is very simple Easy to use, packages are very new. This is the official help homewbrew, please skip if you have installed it. At the same time, to ensure the smooth installation of subsequent libraries. Please updatehomebrew

$ brew update && brew upgrade
Copy after login

Wait for a few minutes

Install PHP7

Then run it in your command line The following lines of code

$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
//安装php7
$ brew install php70
//如果你通过homebrew安装了之前的php版本
//你可以解绑他们,如果用的就是mac自带的PHP 就跳过
$ brew unlink php56
Copy after login

Configure the apache file

//用vim打开
$ sudo vim /etc/apache2/httpd.conf
Copy after login

If your httpd.conf has been changed in a mess before, I suggest you find it httpd.conf~previous in the same directory is copied and overwritten httpd.conf

//把php5的模块 注释掉
#LoadModule php5_module libexec/apache2/libphp5.so
//加入php7的模块
LoadModule php7_module/usr/local/opt/php70/libexec/apache2/libphp7.so
Copy after login

Restart apache

$ sudo apachectl start
//or
$ sudo apachectl restart
//如果php发现不行,执行看看报错
$ apachectl
Copy after login

Related recommendations: "PHP Public Welfare Training"

The above is the detailed content of Detailed tutorial on installing PHP7 under OSX. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
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