菜单

Installing PHP 7 on OS X Yosemite

2016年03月23日 - php

How to install it?

This tutorial is for OS X users, some procedures might apply for some linux versions too (apache configuration)

1. Get Homebrew

Homebrew is a package manager for OS X. Find install instructions HERE.

2. Install PHP 7 via Homebew

Then, run the following in your command-line:
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php

//Installation
$ brew install php70

//If you installed earlier versions with homebrew
//you might need to unlink them
$ brew unlink php56

3. Configure Apache

Open the default Apache configuration file with your favourite text editor.
//Open with vim or any other text editor
$ sudo vim /etc/apache2/httpd.conf

//If you don’t like using CLI, you can open the folder in Finder
$ open /etc/apache2/
Search for php5_module (should be near line 171) and edit the httpd.conf like this:

#Comment out the PHP5 module
#LoadModule php5_module libexec/apache2/libphp5.so

#Enable PHP 7 module
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so


SetHandler application/x-httpd-php

4. Restart apache

Run this command to restart the default OS X apache server:
$ sudo apachectl restart
If you encountered errors or i you want to test your httpd.conf file, run ‘apachectl’ in terminal.

发表评论

电子邮件地址不会被公开。 必填项已用*标注