Wrong JPEG library version: library is 70, caller expects 62

sneakerpeet

Verified User
Joined
Oct 25, 2009
Messages
5
Location
Amsterdam
I'm trying to get my PHP 5.2 going on my 1.2 custom build, but somehow converting JPG images doesn't work, converting and scaling PNG's work fine.
This is the warning I got in the page:
Code:
Warning: imagecreatefromstring() [function.imagecreatefromstring]: gd-jpeg: JPEG library reports unrecoverable error: in /usr/home/<myuser>/domains/<mydomain>/public_html/wp-admin/includes/image.php on line 147

Warning: imagecreatefromstring() [function.imagecreatefromstring]: Passed data is not in 'JPEG' format in /usr/home/<myuser>/domains/<mydomain>/public_html/wp-admin/includes/image.php on line 147

Warning: imagecreatefromstring() [function.imagecreatefromstring]: Couldn't create GD Image Stream out of Data in /usr/home/<myuser>/domains/<mydomain>/public_html/wp-admin/includes/image.php on line 147

Warning: imagecreatefromstring() [function.imagecreatefromstring]: gd-jpeg: JPEG library reports unrecoverable error: in /usr/
I also dug around in the logs and got this a couple of times in my Apache2 log:
Code:
Wrong JPEG library version: library is 70, caller expects 62
Anyone got an idea?

Oh, here's my options.conf snippet
Code:
#PHP settings. default_php possible values - 5 or 6
default_php=5
php5_cli=yes
php5_cgi=no
php6_cli=no
php6_cgi=no
php_ini=no
#Possible values - recommended or dist
php_ini_type=recommended
zend=yes

#Possible values - 5.0, 5.1
mysql=5.1
mysql_inst=yes
mysql_backup=yes

#Possible values - 1.3, 2.0 or 2.2
apache_ver=2.2
 

avy

New member
Joined
Nov 14, 2009
Messages
1
I have this problem too :(
What say support team about this?
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,050

mmaxx

Verified User
Joined
May 26, 2006
Messages
23
Its actually caused by a mismatch of libjpeg and GD.
In freebsd 7.x for example, libjpeg has moved to 7.0 default, while the GD bundled with php expects ver 6.2
This does still present some problem as installing gd from ports DOES not seem to gell with custombuild or php 5.2.12, this was after installing GD from ports, then symlinking the .h files from /usr/local/include to /usr/local/lib and using the DA method for adding extensions:

Code:
>--with-gd=/usr/local/lib \
./build php n

gives this

ext/gd/.libs/gd.o(.text+0x9dd): In function `php_free_gd_image':
/usr/local/directadmin/custombuild/php-5.2.12/ext/gd/gd.c:1203: undefined reference to `php_gd_gdImageDestroy'
ext/gd/.libs/gd.o(.text+0xbd0): In function `_php_image_bw_convert':
/usr/local/directadmin/custombuild/php-5.2.12/ext/gd/gd.c:4909: undefined reference to `php_gd_gdImageWBMPCtx'
*** Error code 1
1 error
so will have to keep looking or try to build php from ports as well.
 

mmaxx

Verified User
Joined
May 26, 2006
Messages
23
php, System GD, FreeBSD, libjpeg 7 [SOLVED]

Install GD from ports.
Symlink the gd*.h files from the /usr/local/include dir to /usr/local/lib
in custombuild dir
DELETE php... dir

Code:
mkdir custom/ap2/
touch custom/ap2/configure.php5
put this in it:

Code:
#!/bin/sh
./configure \
        --enable-shared \
        --with-apxs2 \
        --with-curl=/usr/local/lib \
        --with-gd=/usr/local/lib \
        --with-ttf \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-freetype-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=/usr/local/mysql \
        --with-mysqli=/usr/local/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mysql \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --enable-zip \
        --with-iconv=/usr/local \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-mbstring \
        --enable-wddx
then

Code:
./build php n
Worked for me...
 

BigWil

Verified User
Joined
Aug 5, 2004
Messages
313
Scratch my previous workaround for this issue. Previous worked on one or two servers but others were VERY difficult. Well I finally found the fix that works well on them all. Going back to version 62 and meeting the requirements of GD and other apps.

wget http://files.directadmin.com/services/customapache/jpegsrc.v6b.tar.gz
tar zxf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure
make
make install

I tested all of the port applications that were dependent and they all still work fine. I even reinstalled a couple with the 62 in place. No bugs. I can now upload and resize in PHP after 3 days of not being able to. Yeah!

(John and Smtalk should you maybe include this in custombuild like it used to be in customapache?)

BigWil
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,050
Hello,

How is that different from what we already have in custombuild?
Code:
./build libjpeg
let me know what I'm missing.. as it's there, and uses the same version too.

John
 

BigWil

Verified User
Joined
Aug 5, 2004
Messages
313
I guess maybe I over looked that and never would have known it was there. I made the nasty assumption that since it wasn't in the options.conf, wasn't downloaded during the updates and wasn't installed during the ./build all that it had been discontinued. My bad completely.

Ok so forget all the ruckus above trying to figure out how to fix this issue. The answer was simply

./build libjpeg

BigWil
 

Atlanticbit

Verified User
Joined
Jul 24, 2009
Messages
7
Location
Brazil
same problem, after retrying the same, it finally worked!

I did all what was suggested here, so far the problem continued to exist.
My problem appeared after upgrading to php 5.2.17.

Then I tried again, but instead of deinstall gd I pkg_delete it.
Then pkg_add it again.
Adapted the configure.php5, build libjpeg and build php n again, then finally it seems the problem is over, does not appear anymore......ufa........:)
 

polo

Verified User
Joined
Apr 2, 2005
Messages
122
Hey guys i have done everything mentioned above updated to php53 but images will not display... phpinfo says gd is enabled jpeg is enabled etc etc but my images wont show up on a few of my clients websites... also get error Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error

Please help!
 

Bolk

New member
Joined
Feb 11, 2011
Messages
4
Hey guys i have done everything mentioned above updated to php53 but images will not display... phpinfo says gd is enabled jpeg is enabled etc etc but my images wont show up on a few of my clients websites... also get error Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error

Please help!
On FreeBSD 8.1 amd64 I deleted the libjpeg.so modules from the /usr/local/lib dir and performed ./build libjpeg and ./build php n.

This solved the issue for us.
 

Atlanticbit

Verified User
Joined
Jul 24, 2009
Messages
7
Location
Brazil
My error returned after upgrading to php5.3, I had to repeat again what I posted before.
Is this a bug?
Running php in cgi mode with suPHP
 

mmx

Verified User
Joined
May 8, 2005
Messages
114
Location
Montreal, QC, Canada
Install GD from ports.
Symlink the gd*.h files from the /usr/local/include dir to /usr/local/lib
in custombuild dir
DELETE php... dir

Code:
mkdir custom/ap2/
touch custom/ap2/configure.php5
put this in it:

Code:
#!/bin/sh
./configure \
        --enable-shared \
        --with-apxs2 \
        --with-curl=/usr/local/lib \
        --with-gd=/usr/local/lib \
        --with-ttf \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-freetype-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=/usr/local/mysql \
        --with-mysqli=/usr/local/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mysql \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --enable-zip \
        --with-iconv=/usr/local \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-mbstring \
        --enable-wddx
then

Code:
./build php n
Worked for me...

This worked on FreeBSD 8.2 64-bit as well. Thank you.
 

sorachat

New member
Joined
Aug 14, 2011
Messages
2
Refer & Thank : maxx

i follow you and everything work for me,

1) Install GD from ports. & Make a Symlink the gd*.h files from the /usr/local/lib to /usr/local/include

Code:
/usr/ports/graphics/gd
setenv FORCE_PKG_REGISTER 1
make install
cd /usr/local/lib
ln -s /usr/local/include/gd*.h .
2) Add custom modules to php with custombuild

Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp -fp configure/ap2/configure.php5 custom/ap2/configure.php5
put this in it:

Code:
#!/bin/sh
./configure \
        --enable-shared \
        --with-apxs2 \
        --with-curl=/usr/local/lib \
        --with-gd=/usr/local/lib \
        --with-ttf \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-freetype-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=/usr/local/mysql \
        --with-mysqli=/usr/local/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mysql \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --enable-zip \
        --with-iconv=/usr/local \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-mbstring \
        --enable-wddx
then

Code:
./build php n
4) Restart apache:

Code:
/usr/local/etc/rc.d/httpd restart


source: http://help.directadmin.com/item.php?id=436
http://help.directadmin.com/item.php?id=252
 

Lucius

Verified User
Joined
Feb 21, 2013
Messages
8
A clean solution

Hi Gents,

I had this same issue and used the external GD instead which works just fine.

One side note to the solutions presented here:

If you use "/usr/local/lib" as the base for the GD install the PHP configure script can't
find the header files for the base is "/usr/local" and not "/usr/local/lib". Making a symlink
of the GD header files in the directory is unneeded since the PHP script will search down
it base directory for the needed header and library files.

This is my configure.php5 file (I use ffmpeg too, you may not need that):

[root@speed /usr/local/directadmin/custombuild]# more custom/ap2/configure.php5
#!/bin/sh
./configure \
--enable-shared \
--with-apxs2 \
--with-curl=/usr/local \
--with-gd=/usr/local \
--with-ttf \
--with-gettext \
--with-jpeg-dir=/usr/local \
--with-freetype-dir=/usr/local \
--with-kerberos \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--with-pear \
--with-png-dir=/usr/local \
--with-zlib \
--with-zlib-dir=/usr/local \
--enable-zip \
--with-iconv=/usr/local \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-mbstring \
--with-ffmpeg=yes \
--enable-wddx

"./build libjpeg" is also not needed for it is better to use the jpeg which
GD is build against.. which is the jpg installed with ports.

Regards,

Lucius
 

Lucius

Verified User
Joined
Feb 21, 2013
Messages
8
The best solution for me so far

I got this working reliable and documented the solution.
Here you have it.

Don't use GD and jpeg from ports !!

Put the following in configure.php5 in
/usr/local/directadmin/custombuild/custom/ap2/

#!/bin/sh
./configure \
--with-apxs2 \
--with-icu-dir=/usr/local \
--with-curl=/usr/local \
--with-gd \
--with-gettext \
--with-jpeg-dir=/usr/local \
--with-freetype-dir=/usr/local \
--with-kerberos \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--with-png-dir=/usr/local \
--with-zlib \
--with-zlib-dir=/usr/local \
--with-iconv=/usr/local \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-soap \
--enable-sockets \
--enable-mbstring \
--enable-zip \
--enable-wddx \
--disable-mbregex \
--with-ffmpeg=yes

For ffmpeg you need to install "fmpeg-0.7.3,1" from ports

Use directadmin's "build" and do:
./build icu
./build libjpeg
./build php y

These are my installed (82) packages on FreeBSD 9.1:

[root@speed ~/procedures]# pkg_info | more
autoconf-2.68 Automatically configure source code on many Un*x platforms
autoconf-wrapper-20101119 Wrapper script for GNU autoconf
automake-1.11.1 GNU Standards-compliant Makefile generator (1.11)
automake-wrapper-20101119 Wrapper script for GNU automake
bash-4.1.10 The GNU Project's Bourne Again SHell
bigreqsproto-1.1.1 BigReqs extension headers
binutils-2.21.1 GNU binary tools
bison-2.4.3,1 A parser generator from FSF, (mostly) compatible with Yacc
cmake-2.8.4_1 A cross-platform Makefile generator
cyrus-sasl-2.1.23_3 RFC 2222 SASL (Simple Authentication and Security Layer)
damageproto-1.2.1 Damage extension headers
db41-4.1.25_4 The Berkeley DB package, revision 4.1
dri2proto-2.3 DRI2 prototype headers
expat-2.0.1_1 XML 1.0 parser written in C
ffmpeg-0.7.3,1 Realtime audio/video encoder/converter and streaming server
fixesproto-4.1.2 Fixes extension headers
flex-2.5.35_4 Fast lexical analyzer generator
fontconfig-2.8.0_1,1 An XML-based font configuration API for X Windows
freetype2-2.4.6 A free and portable TrueType font rendering engine
frei0r-1.3_1 Minimalistic plugin API for video effects
gcc-4.6.2 GNU Compiler Collection 4.6
gettext-0.18.1.1 GNU gettext package
glproto-1.4.12 GLX extension headers
gmake-3.82 GNU version of 'make' utility
gmp-5.0.2 A free library for arbitrary precision arithmetic
gpac-libgpac-0.4.5_4,1 Gpac MPEG-4 Systems library and headers
help2man-1.40.4 Automatically generating simple manual pages from program o
inputproto-2.0.1 Input extension headers
kbproto-1.0.5 KB extension headers
libGL-7.4.4 OpenGL library that renders using GLX or DRI
libGLU-7.4.4 OpenGL utility library
libX11-1.3.6,1 X11 library
libXau-1.0.6 Authentication Protocol library for X11
libXdamage-1.1.3 X Damage extension library
libXdmcp-1.0.3 X Display Manager Control Protocol library
libXext-1.1.2,1 X11 Extension library
libXfixes-4.0.4 X Fixes extension library
libXxf86vm-1.1.0 X Vidmode Extension
libcheck-0.9.8 A unit test framework for C
libdrm-2.4.12_1 Userspace interface to kernel Direct Rendering Module servi
libgcrypt-1.5.0 General purpose crypto library based on code used in GnuPG
libgpg-error-1.10 Common error values for all GnuPG components
libiconv-1.13.1_1 A character set conversion library
libidn-1.22 Internationalized Domain Names command line tool
libogg-1.2.2,4 Ogg bitstream library
libpthread-stubs-0.3_3 This library provides weak aliases for pthread functions
libtheora-1.1.1_2 Theora video codec for the Ogg multimedia streaming system
libtool-2.4 Generic shared library support script
libvorbis-1.3.2,3 Audio compression codec library
libvpx-0.9.6 VP8 Codec SDK
libxcb-1.7 The X protocol C-language Binding (XCB) library
libxml2-2.7.8_1 XML parser library for GNOME
libxslt-1.1.26_3 The XSLT C library for GNOME
m4-1.4.16,1 GNU m4
makedepend-1.0.3,1 A dependency generator for makefiles
mpc-0.9 Library of complex numbers with arbitrarily high precision
mpfr-3.0.1 A library for multiple-precision floating-point computation
nasm-2.09.10,1 General-purpose multi-platform x86 and amd64 assembler
opencv-core-2.3.1 OpenCV core libraries
orc-0.4.14_1 Library and toolset to operate arrays of data
p5-Locale-gettext-1.05_3 Message handling functions
perl-5.12.4_1 Practical Extraction and Report Language
pkg-config-0.25_1 A utility to retrieve information about installed libraries
png-1.4.8 Library for manipulating PNG images
portmaster-3.9.1 Manage your ports without external databases or languages
python27-2.7.2_1 An interpreted object-oriented programming language
ruby-1.8.7.352_2,1 An object-oriented interpreted scripting language
ruby-flvtool2-1.0.6 Manipulation tool for Macromedia Flash Video files
schroedinger-1.0.10 High-speed Dirac codec
texi2html-1.82,1 Texinfo to HTML converter
wget-1.12_4 Retrieve files from the Net via HTTP(S) and FTP
x264-0.115.2000 Library and tool for encoding H.264/AVC video streams
xcb-proto-1.6 The X protocol C-language Binding (XCB) protocol
xcmiscproto-1.2.0 XCMisc extension headers
xextproto-7.1.1 XExt extension headers
xf86bigfontproto-1.2.0 XFree86-Bigfont extension headers
xf86vidmodeproto-2.3 XFree86-VidModeExtension extension headers
xorg-macros-1.11.0 X.Org development aclocal macros
xproto-7.0.16 X11 protocol headers
xtrans-1.2.5 Abstract network code for X
xvid-1.3.2,1 An opensource MPEG-4 codec, based on OpenDivx
yasm-1.1.0 A complete rewrite of the NASM assembler
[root@speed ~/procedures]#

Lucius
 

wattie

Verified User
Joined
May 31, 2008
Messages
1,099
Location
Bulgaria
Ok, the confirmed solution is similar to what Lucius said.

1. deinstall gd and libjpeg from ports

cd /usr/ports/graphics/jpeg
make deinstall
cd /usr/ports/graphics/gd
make deinstall
2. Install libjpeg from custombuild

cd /usr/local/directadmin/custombuild/
./build libjpeg
3. In /usr/local/directadmin/custombuild/custom/ap2/configure.php54 make sure that you have:

--with-gd \
--with-jpeg-dir=/usr/local \
Then recompile PHP and it will work fine.

The difference is the path in the --with-jpeg-dir - the template shows it as /usr/local/lib. Making it /usr/local fixes the php build issue and it builds successfully against the correct libjpeg version.
 
Last edited:

Royal Flash

Verified User
Joined
Aug 19, 2012
Messages
27
I tried to correct the error on the instructions http://help.directadmin.com/item.php?id=436. ./build php n fails "Unable to find libgd.(a|so) >= 2.1.0 anywhere under /usr/local/lib". Files libgd.a, libgd.so.4 and libgd.so present in /usr/local/lib. After updating ports i install gd, pkg_version print: gd-2.0.35_9,1 = up-to-date with port. The site is already available http://libgd.bitbucket.org/ GD version 2.1.0. It turns out that the ports Freebsd is an old version of GD? How do I solve this problem?

Installed on the server: FreeBSD 8.4 and PHP as suPHP.
 
Top