升级后,PHP不再支持PNG操作 [英] After upgrade, PHP no longer supports PNG operations

查看:198
本文介绍了升级后,PHP不再支持PNG操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到Mac OS X 10.10(Yosemite)并启动具有PHP支持的Apache之后,除对PNG文件进行的任何图像操作外,其他所有操作均像以前一样.我得到一个Call to undefined function imagecreatefrompng(),而对JPEG文件的任何操作都起作用.因此存在GD,但不存在PNG.

After updating to Mac OS X 10.10 (Yosemite) and starting Apache with PHP support, everything works as before except for any image operations on PNG files. I get a Call to undefined function imagecreatefrompng(), while any operation on JPEG files work. So GD is present, but not for PNG.

phpinfo()中有一行看起来像是问题:'--with-png-dir = no'

There is one line in the phpinfo() that looks like the problem: '--with-png-dir=no'

phpinfo()中的GD部分:

如何获取随附的PHP以使用PNG文件?

How do I get the included PHP to work with PNG files?

推荐答案

这是liip的另一个选择,这里.这是一个为优胜美地预先构建的PHP软件包(较旧的版本也适用),但是它只是一行代码:

Here's another option, from the guys from liip, here. This is a PHP package that comes pre-built for Yosemite (older versions works too) but it is just one line of code:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

此后,一切准备就绪即可按预期工作.该安装附带的配置非常适合Symfony 2开发,但它在其他用例中也可以正常工作.

After that, everything is ready to work as expected. The configuration that cames with that installation is well suited for Symfony 2 development, but it should work just fine with other use cases.

最后,如果您也需要使用更新的PHP CLI,但又不想使用操作系统随附的PHP版本,则还可以添加到.bash_profile或类似的代码行中:

Finally, if you need to use the updated PHP CLI, too, but you don't want to use the PHP version that comes with the OS, then you could also add to your .bash_profile or similar this line of code:

export PATH=/usr/local/php5/bin:$PATH

这篇关于升级后,PHP不再支持PNG操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆