1. 程式人生 > >PHP 執行錯誤undefined imagecreatefromjpeg和undefined exif imagety

PHP 執行錯誤undefined imagecreatefromjpeg和undefined exif imagety

               

安裝環境是CentOS6.2+PHP5.3.28,PHP已編譯過。

1. 如果發現exif_imagetype呼叫導致fatal error

那麼檢查exif擴充套件有沒有安裝,擴充套件的動態安裝方法是使用phpize(php install zend extension)

 cd /root/php-5.3.28/ext/@[email protected] phpize (this command will generate compile configure file 4 the module) ./configure [email protected]@ make && make install  (@
[email protected]
will be installed under extension dir:@[email protected]/lib/php/extensions/no-debug-non-zts-20090626/)

然後在php.ini檔案中新增擴充套件:

[email protected]@.so

2.如果是imagecreatefromjpeg導致fatal error

那麼檢查gd擴充套件有沒有安裝,方法同上

重啟httpd服務後,檢查phpinfo的資訊,確認png/gif/jpeg都得到支援

如果只有PNG/GIF Support,而沒有JPEG Support那一項,那意味著libjpeg沒有被編譯進GD2.1裡面去,

首先安裝jpeg:

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

然後重新編譯GD:
cd ../gdphpize./configure --with-jpeg-dir=/usr/local/jpeg [email protected]@make cleanmake && make install

如果GD已編譯過,那麼上面的make clean是必須的,否則不起作用。

重啟httpd服務即可。

by iefreer