admin管理员组文章数量:1516870
查阅很多资料,问题如下:
mac系统升级到yosemite后,php也自动升级,运行phpcms时发现后台验证码显示不出来。很明显,缺少gd库,需要重新编译安装php,其过程十分辛苦。
但使用brew安装比较方便。
所以操作步骤如下:
1、安装brew(已经安装的略过)
2、安装php5.6
3、安装
freetype
,
jpeg
,
libpng
,
gd
,
zlib
具体过程:
安装homebrew
$ ruby -e "$(curl -fsSL )"
这里由于网速原因估计会比较慢
完成后,接下来自检一下:
$ 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 Updatein the App Store.出现一些警告信息,其中也说明了如果brew运行正常就不用管它。CTRL+C退出,继续往下
配置第三方源
因为homebrew没有自带php的包,所以要添加新的源进来:
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php安装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
重启完成后,看看验证码是否显示了
参考链接:
版权声明:本文标题:Mac环境下的PHP验证代码卡顿?解决不显示的困扰 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.betaflare.com/biancheng/1771756226a3269116.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论