Solved

Installing PHP 5.04 on Centos 6.4 with GD

Posted on 2013-11-26
26
1,145 Views
Last Modified: 2013-12-05
We managed to install PHP 5.04 from source on Centos 6.4. For various reasons, that
is what we are going for. Then we decided to reinstall with gd support.

./configure --with-mysql --with-libdir=lib64 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-apxs2 --with-libdir=lib64 --with-zlib --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --disable-debug --with-pic --disable-rpath --with-bz2 --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --without-openssl --with-png --with-pspell --with-expat-dir=/usr --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-pear=/usr/share/pear --with-kerberos --enable-ucd-snmp-hack --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-mime-magic=/etc/httpd/conf/magic --without-sqlite --with-libxml-dir=/usr --with-xml --with-apxs2=/usr/sbin/apxs --with-gd --without-odbc --disable-dom --disable-dba --without-curl

But then getting this error:
configure: error: libjpeg.(a|so) not found.

Any ideas to remedies?
0
Comment
Question by:itnifl
  • 11
  • 9
  • 6
26 Comments
 
LVL 19

Accepted Solution

by:
xterm earned 323 total points
Comment Utility
Yes, do:

yum install libjpeg-devel

Then re-run your configure command.  Let me know if other dependencies fail.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
Yes, forgot to mention, already did that. We had this in the start before configure:

yum install gcc gcc-c++ httpd-devel apr-devel libxml2-devel zlib zlib-devel mysql-devel openssl-devel make flex bzip2 bzip2-devel curl-devel libjpeg-devel libc-client-devel libmcrypt-devel libX11-devel gd-devel libpng-devel gmp gmp-devel pcre pcre-devel mingw32-pcre php-pspell aspell-devel
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
Please run the following command for me:

rpm -ql libjpeg-devel
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
#rpm -ql libjpeg-devel
package libjpeg-devel is not installed

#yum install libjpeg-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.uninett.no
 * extras: ftp.uninett.no
 * updates: ftp.uninett.no
Setting up Install Process
Package libjpeg-turbo-devel-1.2.1-1.el6.x86_64 already installed and latest version
Nothing to do
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
Is this a Storm server?

At any rate, please do:

rpm -ql libjpeg-turbo-devel

I'd like to see where it locates it's libraries so that we can understand why your configure script can't find them...
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
By the way, this is not related to your issue, but in the interest of being complete, your configure command contains multiple invalid directives:

--with-exec-dir, --with-png, --with-expat-dir, --enable-magic-quotes, --enable-track-vars, --enable-trans-sid, --enable-yp, --enable-ucd-snmp-hack, --enable-memory-limit, --enable-dbx, --enable-dio, --with-mime-magic, --without-sqlite, --with-xml, --without-odbc

Some are just typos (ie. sqlite should be sqlite3) but others just don't exist.

Also, in your prerequisites you installed a binary php-pspell which you will want to uninstall now that you're building from source.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
The configure string evolved from something taken from phpinfo(); of a different php 5.04 install to this. There has been a lot of copy pasting and editing since then.

 # rpm -ql libjpeg-turbo-devel
/usr/include/jconfig.h
/usr/include/jerror.h
/usr/include/jmorecfg.h
/usr/include/jpeglib.h
/usr/lib64/libjpeg.so
/usr/share/doc/libjpeg-turbo-devel-1.2.1
/usr/share/doc/libjpeg-turbo-devel-1.2.1/coderules.txt
/usr/share/doc/libjpeg-turbo-devel-1.2.1/example.c
/usr/share/doc/libjpeg-turbo-devel-1.2.1/jconfig.txt
/usr/share/doc/libjpeg-turbo-devel-1.2.1/libjpeg.txt
/usr/share/doc/libjpeg-turbo-devel-1.2.1/structure.txt
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
libjpeg.so is in /usr/lib64 just as you'd expect - are you by chance using a copy of a PHP source tree that has been ./configure'd on another system before?  It seems like maybe it's caching some information from being set up on a 32-bit system.

Please try this in the PHP source tree, and then run your configure again:

make distclean

If it fails, please open config.log, locate the section referencing libjpeg, and paste it here.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
I checked with ./configure --help to see if the options were invalid. This is php 5.04 (from 2005 I think..) so I guess things are a bit different then they are today. All the options you mentioned were valid, except these that I now removed:
 --enable-track-vars, --enable-trans-sid, --without-odbc

After make distclean and then running configure I end up with the same error:
configure: error: libjpeg.(a|so) not found.

I then check config.log and search for "libjpeg":
configure:30887: checking whether to enable FTP support
configure:31171: checking for GD support
configure:31218: checking for the location of libjpeg
configure:31245: checking for the location of libpng
configure:31298: checking for the location of libXpm
configure:31323: checking for FreeType 1.x support
configure:31348: checking for FreeType 2
configure:31373: checking for T1lib support
configure:31398: checking whether to enable truetype string function in GD
configure:31423: checking whether to enable JIS-mapped Japanese font support in GD
configure:31477: checking for fabsf
configure:31505: gcc -o conftest -g -O2   conftest.c -lbz2 -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
configure:31489: warning: conflicting types for built-in function 'fabsf'
configure:31477: checking for floorf
configure:31505: gcc -o conftest -g -O2   conftest.c -lbz2 -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
configure:31489: warning: conflicting types for built-in function 'floorf'

Can't say this tells me much.
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
I guess I originally read that as "5.4" not "5.04" - I downloaded the 5.4.22 source from PHP.net and it configured without any errors other than warnings of those invalid directives (some of them were evidently still okay back in 5.0x days)

Is there any particular reason you have to have that exact version?  There are probably hundreds of bugfixes since then, and some of them may directly relate to the configure script not picking up libjpeg.  BTW, the config.log doesn't say much - can you attach the whole thing, along with the actual file "configure" so that I can look through them?  Just upload them as attachments rather than trying to paste...
0
 
LVL 21

Expert Comment

by:Mazdajai
Comment Utility
Have you try installing 5.3? There are many bug fixes on 5.3+.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
"For various reasons, that  is what we are going for." In other words, we have reasons to install 5.04. The code used on the web server is made in 2005. There is a lot of code and we can't take responsibility to change it to a working version for 5.3.3 that comes with Centos 6.4(yum install php). The whole thing boils down to get 5.04 installed.
config.log
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
There are so many OS-level functions that are changed or deprecated that you will likely have a really hard time getting this built in that environment.

Honestly, I think you'd have better luck visiting the vaults/archives and seeing if you can find some OS media from around that time so that your system libraries will match what you are compiling.

Is that an option?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Author Comment

by:itnifl
Comment Utility
It could be, but having Centos 4 installed (maybe Centos 5?) is not really nice to have in a large production environment. There were also problems with the previous installation. The file system was being set in read only frequently. The last time this happened we rebooted and ran fsck ending up with "journal inode is deleted" and "kernel panic - not syncing, attempting to kill init!" at bootup. Thats where we decided to try a new install. See http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&externalId=51306

I guess we could try Centos 4 or 5 with the right kernel versions.

Centos 4.8 or 4.9 propably could do the trick:
http://en.wikipedia.org/wiki/CentOS
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
Every time I've had issues with a filesystem being set read-only, I had multiple hardware level disk errors along with it, and basically expected to have to replace those drives very soon.

I do agree that having old OS in production environment is far from ideal, but if you take a new one and downgrade a bunch of libraries to support old software, you're creating a bit of a hybrid monster anyway - I guess it's a matter of picking your poison.  There may be some old compat packages you can snag, or perhaps create a custom library directory and just link against those instead of the new ones.  I found a lot of issues in config.log that a competent C programmer (that would not be me, regrettably) could probably address if they're used to working in the Unix environment.  Maybe add some programming language tags to this question to see if you can draw in an expert with another opinion?
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 177 total points
Comment Utility
Try.

yum install libjpeg-devel.i386

Open in new window


Also compile with cli and cgi in your test env and see if it makes a difference.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
The ones I have access to are these:
 #yum search libjpeg
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.uninett.no
 * extras: ftp.uninett.no
 * updates: ftp.uninett.no
============================= N/S Matched: libjpeg =============================
libjpeg-turbo-devel.i686 : Headers for the libjpeg-turbo library
libjpeg-turbo-devel.x86_64 : Headers for the libjpeg-turbo library
libjpeg-turbo-static.x86_64 : Static version of the libjpeg-turbo library
libjpeg-turbo.i686 : A MMX/SSE2 accelerated library for manipulating JPEG image
                   : files
libjpeg-turbo.x86_64 : A MMX/SSE2 accelerated library for manipulating JPEG
                     : image files

Tried installing the i686 version, but made no difference. Tried compiling with the options you mentioned, same result.
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 177 total points
Comment Utility
Can you post the full compile log?
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
Config.log is included above at post posted at 06:08:42. Where can I find the compile log? Can't see such a name under /tmp/php-5.0.4 where I run configure.
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 177 total points
Comment Utility
Normally they are on the screen, I would expect to see the error in config.log.

Try piping the standard output to a file.
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
I attached the compile log that was output to screen when running configure. There were three errors actually:
configure: warning: You will need bison if you want to regenerate the PHP parsers.
configure: warning: You will need flex 2.5.4 if you want to regenerate Zend/PHP lexical parsers.
configure: error: libpng.(a|so) not found.
compile.log
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 177 total points
Comment Utility
I was searching for libjpeg error but couldn't find it in the log...not sure why it is a different error.

I assume you already check /usr/lib and /usr/lib64 directory that libpng.so and libjpeg.so exists?
0
 
LVL 2

Author Comment

by:itnifl
Comment Utility
I ran the configure command with this added:
>> log.log 2>> log.log
Errors should have come in the log also. They were:
configure: warning: You will need bison if you want to regenerate the PHP parsers.
configure: warning: You will need flex 2.5.4 if you want to regenerate Zend/PHP lexical parsers.
configure: error: libpng.(a|so) not found.

Mazdaji: you are asking a question that is already answered in this thread =) See my post posted 2013-11-26  at 18:57:15.
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 323 total points
Comment Utility
yum install libpng-devel

or

yum install libpng-devel.i386
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 177 total points
Comment Utility
itnifl,

I have a habit to search / grep for keywords, I didn't look at the entire config.log. The search for 'libjpeg' in your config.log returns nothing so I assume something is not right. I see you did install libpng and libjpeg in your yum command but checking it doesn't hurt as the compile is complaining about them.

I managed to installed 5.04 php (via your commands) and compiled successfully in my lab box without the lib errors.

If you have verified all necessary libraries (i386 and x86-64) are installed then I would suggest reinstalling the system if it is possible.
0
 
LVL 2

Author Closing Comment

by:itnifl
Comment Utility
We ended up using Centos 5.9 with php 5.1.6. The code from several years ago for php 5.04 worked there, for the most part. A few fixes was needed. However all suggestions here will be used for future reference, so every reply receives points.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now