Gd已安装,但出现“Call to undefined function imagecreatefromjpeg()”错误

7

看起来我的主机支持gd,但我仍然遇到一个错误(PHP版本5.3.28)

Fatal error: Call to undefined function imagecreatefromjpeg()

以下是我的phpinfo:

gd

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
GIF Read Support    enabled
GIF Create Support  enabled
PNG Support enabled
libPNG Version  1.2.44
WBMP Support    enabled
XBM Support enabled

Directive   Local Value Master Value
gd.jpeg_ignore_warning  0   0

如果已启用,您可以联系您的主机提供商。或者您可以发布一个使用此函数的片段。 - Vikas Arora
启用gif,启用png,启用wmbp和xmb。不要涉及jpg,尝试使用imagecreatefromgif。此外,与托管提供商交流很可能会给您“正确”的答案。 - hank
“doesn't gd.jpeg_ignore_warning line means that i have jpeg support?” 的意思是我是否拥有 JPEG 支持? - Yegor Razumovsky
不,这并不意味着您支持jpeg。 - Travis Pessetto
1个回答

8
似乎虽然支持GD,但是没有使用libjpeg编译。gd.jpeg_ignore_warning并不意味着您有JPEG支持。如果这是您自己的服务器,请确保使用--with-jpeg-dir运行配置。您可能需要搜索它。我使用了find / -name libjpeg*命令,并得到了CentOS5的/usr/lib。如果这是一个共享主机,请让他们为您安装它。
我的PHP完整编译如下:
wget http://us1.php.net/distributions/php-5.5.10.tar.gz -O php.tar.gz 
tar -xvf php.tar.gz
cd php-5.5.10
yum -y install libxml2-devel libmcrypt-devel libpng-devel
./configure --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d  --with-apxs2 --with-mysql --with-mysqli --with-zlib --with-curl --with-libdir=lib --with-openssl --with-pdo-mysql --with-mcrypt  --with-pcre-regex --enable-zip --with-gd --enable-mbstring --with-jpeg-dir=/usr/lib
make clean
make 
make install

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