查阅不少资料,问题以下:php
mac系统升级到yosemite后,php也自动升级,运行phpcms时发现后台验证码显示不出来。很明显,缺乏gd库,须要从新编译安装php,其过程十分辛苦。git
但使用brew安装比较方便。github
因此操做步骤以下:apache
一、安装brew(已经安装的略过)
二、安装php5.6
三、安装freetype,jpeg,libpng,gd,zlibruby
具体过程:bash
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"复制代码
这里因为网速缘由估计会比较慢
完成后,接下来自检一下:curl
$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: A newer Command Line Tools release is available. Update them from Software Update in the App Store.复制代码
出现一些警告信息,其中也说明了若是brew运行正常就不用管它。CTRL+C退出,继续往下ui
配置第三方源url
由于homebrew没有自带php的包,因此要添加新的源进来:spa
$ brew tap homebrew/dupes
$ brew tap homebrew/versions $ brew tap homebrew/homebrew-php复制代码
install安装
$ brew install php56复制代码
安装过程须要一段时间,等一下就能够了。
安装freetype,jpeg,libpng,gd,zlib
brew rm freetype jpeg libpng gd zlib brew install freetype jpeg libpng gd zlib
先删除以前的再安装新的复制代码
而后建立连接
brew link --overwrite libpng freetype jpeg
#注意添加overwrite,不然可能会提示冲突 这里可能提示目录权限错误问题:
Error: Could not symlink include/libpng16/png.h 执行命令:
sudo chmod -R 777 /usr/local/include/libpng16
sudo chmod -R 777 /usr/local/include/freetype2复制代码
配置apache支持新安装的php
安装的php在/usr/local/opt/php56目录,apache这边须要修改配置文件,加载进新安装的php模块。
$ LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so复制代码
不要忘记从新启动下apache
$ sudo apachectl restart复制代码
重启完成后,看看验证码是否显示了