1. Mac system with PHP version of 5.6, with brew upgrade to php7.0
If you have used brew to install PHP, first use
Brew Unlink Php56
Php56 that (php5.6 version), if you are using a Mac-led PHP, you can ignore the command.
Next Install php7.0
Brew Install PHP70 --with-gmp--with-httpd--with-debug --with-imap
The following parameters must be brought, if not with parameters, directly using the Brew install PHP70 command installation, the final installation succeeded, there is no libphp7.so. We can't reference php7 in Apache.
(Mac the latest system Sierra release, Apache load PHP module (libphpx.so) no longer default generation, in the installation of PHP7, to add –with-httpd parameters)
After installation, open the PHP70 process
Brew Link Php70
Enter a command to see if the success
Php-v
Modifying the Apache configuration file
Open Apache configuration file
sudo vim/etc/apache2/httpd.conf
Remove the comment for the module php5 and add the PHP7.
#LoadModule Php5_module libexec/apache2/libphp5.so
LoadModule php7_module/usr/local/opt/php70/libexec/apache2/libphp7.so
Note: libphp7.so is installed by default in the/usr/local/opt/php70/libexec/apache2/directory, according to your actual situation, replaced by your own installation path can be.
<ifmodule php7_module>
addtype application/x-httpd-php. php
addtype application/x-httpd-php-source. Phps
<ifmodule dir_module>
directoryindex index.html index.php
</IfModule>
</ Ifmodule>
Change configuration file to Php7_module.
Open the. bash_profile file and add the PHP7 environment variable:
Export Path=/usr/local/opt/php70/bin: $PATH;
And then:
source. bash_profile
You can now use the PHP-V command.
Finally restart Apache,
sudo apachectl restart
2. Install MySQL brew install MySQL install MySQL.
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.17.sierra.bottle.tar.gz
################## ###################################################### 100.0%
==> Pouring mysql-5.7.17.sierra.bottle.tar.gz
==> Using the sandbox
==>/usr/local/cellar/mysql/5.7.17/bin/ Mysqld--initialize-insecure--user=liangze--basedir=/usr/local/cellar/mysql/5.7.17--datadir=/usr/local/var/ MySQL--t
==> caveats
We ' ve installed your MySQL database without a root password. To secure it run:
mysql_secure_installation to
Connect run:
mysql-uroot to
have launchd start MySQL now nd restart at login:
Brew services start MySQL
Or, if you don ' t want/need a background service can just run:
mysql.server start
==> Summary
/usr/local/cellar/mysql/5.7.17:14,226 files, 444.4M
Then we'll run the mysql_secure_installation as the brew prompts, and the error will be after the run:
> mysql_secure_installation
securing the MySQL server deployment.
Enter password for user root:
error:can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
Mo lie, hint says can't find Mysql.sock. Because the MySQL process hasn't started yet.
6. Start MySQL Service
Mysql.server start
7. Rerun (if you do not need to set the password and so on the information directly ignored)
> mysql_secure_installation
8. Finally test the landing
> Mysql-u root-p
3. Installed PHP does Mcrypt module
Many friends use the command Brew install Php70-mcrypt success, but the module does not work.
Solution Idea:
Add parameter (-FS): Try Brew reinstall-fs Php70-mcrypt
Xdebug the same:
Brew Reinstall-fs Homebrew/php/php70-xdebug
4. Install PHP extension Redis
Brew Install--build-from-source Homebrew/php/php70-redis
Reboot the Apache service, using Php-m or phpinfo () to see if the extension was added successfully;
Note: If the error:
This should be less a dependent or igbinary dependent, execute:
If you have installed igbinary dependencies still error: Reinstall:
Brew Reinstall--build-from-source Php70-igbinary
Otherwise install directly: Brew install--build-from-source php70-igbinary
Restart the Apache service when the installation is complete