Home >php教程 >php手册 >PHP:运行错误undefined imagecreatefromjpeg和undefined exif

PHP:运行错误undefined imagecreatefromjpeg和undefined exif

WBOY
WBOYOriginal
2016-06-06 19:51:042471browse

安装环境是CentOS6.2+PHP5.3.28,PHP已编译过。 1. 如果发现exif_imagetype调用导致fatal error 那么检查exif扩展有没有安装,扩展的动态安装方法是使用phpize(php install zend extension) cd /root/php-5.3.28/ext/@extension-name@phpize (this command

安装环境是CentOS6.2+PHP5.3.28,PHP已编译过。

1. 如果发现exif_imagetype调用导致fatal error

那么检查exif扩展有没有安装,扩展的动态安装方法是使用phpize(php install zend extension)

	cd /root/php-5.3.28/ext/@extension-name@
	phpize (this command will generate compile configure file 4 the module)
	./configure --with-php-config=@php-config-path@
	make && make install 
	(@extension@.so will be installed under extension dir:@php-5.3.28-path@/lib/php/extensions/no-debug-non-zts-20090626/)

然后在php.ini文件中添加扩展:

extension=@extension-name@.so


2.如果是imagecreatefromjpeg导致fatal error

那么检查gd扩展有没有安装,方法同上

重启httpd服务后,检查phpinfo的信息,确认png/gif/jpeg都得到支持

PHP:运行错误undefined imagecreatefromjpeg和undefined exif

如果只有PNG/GIF Support,而没有JPEG Support那一项,那意味着libjpeg没有被编译进GD2.1里面去,

首先安装jpeg:

tar zxvf jpegsrc.v8d.tar.gz 
cd jpeg-8d/
./configure --prefix=/usr/local/jpeg --enable-shared
make && make install

然后重新编译GD:
cd ../gd
phpize
./configure --with-jpeg-dir=/usr/local/jpeg --with-php-config=@php-config-path@
make clean
make && make install

如果GD已编译过,那么上面的make clean是必须的,否则不起作用。


重启httpd服务即可。


by iefreer


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn