Home > Article > Backend Development > Detailed tutorial on installing PHP7 under OSX
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
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
Configure the apache file
//用vim打开 $ sudo vim /etc/apache2/httpd.conf
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
Restart apache
$ sudo apachectl start //or $ sudo apachectl restart //如果php发现不行,执行看看报错 $ apachectl
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!