安装了php71w-gd,但是出现了错误:GD库扩展在此PHP安装中不可用。

3

我在CentOS 7服务器上使用Laravel Web框架和Nginx Web服务器,已经安装了php71w-gd,但当我想上传文件时仍然出现这个错误。

Intervention \ Image \ Exception \ NotSupportedException
GD Library extension not available with this PHP installation.

您可能需要了解这些内容

# php -i | grep gd
/etc/php.d/gd.ini,
gd
gd.jpeg_ignore_warning => 1 => 1

安装并启用gd后,您是否重新启动了nginx? - Mohammad Fanni
是的,但错误仍然存在。 - Hamed Abdollahi
2个回答

3

@Hamed Abdollahi请按照以下步骤检查:

GD Graphics库用于动态操作图像。对于Ubuntu系统,您需要手动安装它:

PHP5: sudo apt-get install php5-gd
PHP7.0: sudo apt-get install php7.0-gd
PHP7.1: sudo apt-get install php7.1-gd
PHP7.2: sudo apt-get install php7.2-gd

好的,您可以验证GD支持已加载:

php -i | grep -i gd

输出应该像这样:
GD Support => enabled
GD headers Version => 2.1.1-dev
gd.jpeg_ignore_warning => 0 => 0

谢谢@Mayur,但是我已经在我的CentOS服务器上安装了php71w-gd,但仍然遇到相同的错误。 - Hamed Abdollahi
我看到了,gd.jpeg_ignore_warning => 1 => 1。这是个问题吗?我们如何将它变成0? - ronypatil

3

1
如果您使用“remi-php71”存储库,我建议您永久启用它(它仅提供PHP),这样在尝试安装另一个扩展时就不会遇到问题,如https://rpms.remirepo.net/wizard/中所述。 - Remi Collet

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接