Nerdrium Home

Macintosh

Linux

Web Design

Case Mods

Gardening

Photography

Recipes

 

My Blog

 

Facebook

Twitter

Fixing the gd Problem in RH EL 3

by Michael Greifenkamp (July 12th, 2004)

Earlier this year I purchased a new server to host a web site at work. We purchased RedHat Enterprise Linux ES 3.0, along with a service contract. Trying to make my life as difficult as possible, I installed Apache, MySQL, and PHP from scratch instead of using rpms. I did a full installation of each of these on a test web server that is running Red Hat Linux 9 before doing anything on the new production server. And I kept careful notes.

Note that the versions of Linux are different between the two machines....

Well, when I installed PHP on the test server, I didn't have any problems using the great big long ./configure command that I put together. But that very same command burped badly on the production server. It was having a problem locating something-or-other that was needed for gd and gdbm. Needless to say, at the time, I thought that I would never need graphics support, so I just omitted that part and went along my way.

Except now I need graphics capability. Uh oh.

Time to fix the production server installation. While figuring it out took the better part of the morning, the solution is actually rather simple, and since I found others on the internet having the same problem (without solutions), I thought it fair to post this, so here goes.

The problem is that the libraries for JPEG and PNG cannot be found. I do not know for sure, but I presume that the problem might be that the newer Enterprise Linux has newer libraries that PHP could find on RedHat 9, but not on ES. The first thing I found that I needed was a header file png.h. After that I found that I also needed a configuration file, pngconf.h. Their location on the older server was /usr/include/libpng12/. I created the new directory, libpng12, on the production server and copied those files to it. Then I needed to create a couple of symbolic links so that the PHP compiler would know where to look:

# cd /usr/include
# ln -s libpng12/png.h png.h
# ln -s libpng12/pngconf.h pngconf.h

Now that I took care of that part, I also needed to create a few more symbolic links so that the jpeg and png libraries are located correctly. This is where I think that ES 3 has newer libraries that the PHP installer does not recognize, or something. Anyway. Make those links:

# cd /usr/lib
# ln -s libjpeg.so.62.0.0 libjpeg.so
# ln -s libpng12.so.0.1.2.2 libpng12.so
# ln -s libpng12.so.0.1.2.2 libpng.so

Then I simply recompiled PHP and went along my merry way...

# cd /usr/local/php-4.3.4
# rm config.cache
# make clean
./ configure
(With my whole huge configure command line, including the --with-gd part)
# make
# make install
# cd /usr/local/apache2
# bin/apachectl stop
# bin/apachectl start

And that seemed to do it. If anyone else finds this information useful, that would be cool, considering the number of Bothan spies that sacrificed their lives this morning...

--Michael