Wrong JPEG library version - Thumbnail Creation Problems

General Forum
SarvaiD
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 15 Sep 2011, 04:33

Wrong JPEG library version - Thumbnail Creation Problems

Post by SarvaiD »

I got bit by the infamous Thumbnail creation problem, where Phoca Gallery couldn't create thumbnails for me.

After 4 or so hours of troubleshooting, I thought I would share my solution while it is fresh in my head.

My system is a new Server (intel) running Solaris 10, and all dependent software packages from http://www.sunfreeware.com to run apache-2.2.20-sol10-x86-local and php-5.3.6-sol10-x86-local with Joomla_1.7.0-Stable-Full_Package.zip.

I got the site up and running, loaded a cool template,installed Phoca Gallery, loaded a few images, and bammmm... Error creating thumbnail. I wasn't the first with this problem....

While find a solution, I came across chmod_set.sh and chmod_unset.sh which are a good idea when you're not making changes to the site (to lock down the filesystem from write access via apache). Permissions were not my problem.

Info.php showed me that my PHP was installed correctly, and that GD was there with all applicable modules enabled....

I enabled display_errors = On in my php.ini, and started to see the problem on screen.
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in /data/www/administrator/components/com_phocagallery/libraries/phocagallery/image/imagemagic.php on line 214 Warning: imagecreatefromjpeg(): '/data/www/images/phocagallery/VEG2.JPEG' is not a valid JPEG file.

Well, my JPEG was a valid file, and converting it to a PNG, and back to a JPEG was not the solution. Same error applied.

I think looked in my apache error_log and got the following:
[Wed Sep 14 22:12:38 2011] [notice] Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/1.0.0e DAV/2 PHP/5.3.8 configured -- resuming normal operations
Wrong JPEG library version: library is 62, caller expects 80

I'm a little closer... Looks like a version problem somewhere...
After much trial and error, I ended up downloading the source code for php, and building it myself with the following:

Code: Select all

cd /data/downloads                                                      
wget http://us2.php.net/get/php-5.3.8.tar.gz/from/us.php.net/mirror     
gunzip php-5.3.8.tar.gz                                                 
tar -xvf php-5.3.8.tar.gz                                               
cd php-5.3.8                                                            
make clean                                                              
./configure \                                                           
	--prefix=/usr/local/php \                                          
	--with-config-file-path=/usr/local/php/lib \                       
	--enable-mbstring \                                                
	--with-mysql=/opt/mysql/mysql \                                    
	--with-mysql-sock=/tmp/mysql.sock \                                
	--with-curl \                                                      
	--enable-zip \                                                     
	--enable-sockets \                                                 
	--enable-exif \                                                    
 		     --enable-gd-native-ttf \                                 
	--with-iconv \                                                     
	--with-gd \                                                        
	--with-zlib \                                                      
	--with-bz2 \                                                       
	--with-libxml-dir=/usr/lib \                                       
	--with-jpeg-dir=/usr/lib \                                         
	--with-png-dir=/usr/lib \                                          
	--with-zlib-dir=/usr/lib \                                         
	--with-freetype-dir=/usr/lib \                                     
	--with-apxs2=/usr/local/apache2/bin/apxs                           
make                                                                    
make test                                                               
make install                                                            
/usr/local/apache2/build/libtool --finish /data/downloads/php-5.3.8/libs
I restarted Apache and things seemed okay, but I got the same error. A little more Google, and I found reference to the jpeglib.h. I searched my system, and found I had two versions of this file in my usable path (/usr/sfw isn't in a normal path directory, so I wasn't concerned about it)...

root@www 22:18 /data/downloads>locate jpeglib.h
/usr/include/jpeglib.h
/usr/local/include/jpeglib.h
/usr/sfw/include/mozilla/jpeg/jpeglib.h

I did a "more /usr/include/jpeglib.h" and found it was for jpeg version 6.2, and "more /usr/local/include/jpeglib.h" was for 8.0. So I moved the 6.2 library file (mv /usr/include/jpeglib.h /usr/include/jpeglib.h.bak) and created a symbolic link to replace it (ln -s /usr/local/include/jpeglib.h /usr/include/jpeglib.h).

I then rebuilt PHP with the same process outlined above, and restarted apache.... Whola, JPEG thumbnail creation works.

This is a pretty tough problem (at least for me) to isolate down to a .h file. But it makes sense that PHP may grab one over the other when building. I'm not sure how it all works, nor do I care, but I'm happy that I can at least test the functionality of Phoca, which better work!
:D
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Wrong JPEG library version - Thumbnail Creation Problems

Post by Jan »

Hi, no experiences with such problem yet :-)

Jan
If you find Phoca extensions useful, please support the project
Post Reply