下午同事发来一php项目,使用的是php5.3,但本机安装的是php7 只能进行切换,大概记录下切换的过程,整个过程折腾了一个下午

1.使用brew

2.安装xcode-tools xcode-install –install

3.brew update

4.brew tap homebrew/dupes

5.brew tap homebrew/versions

6.brew tap homebrew/homebrew-php

7.安装对应版本,如果是安装php5.3

brew install homebrew/php/php53 –with-fpm –with-apache

否则会出现不生成libphp5.so文件

8.在apache的配置文件中加载指定版本的php静态库

1
2
3
ln -sfv /usr/local/opt/php53/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php53.plist

9.修改apache中httpd.conf文件

1
LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so

10.sudo apachectl restart

–EOF–