New Titles

Two days spent on bringing fancy titles to the site, and I think I finally got it nailed.

I saw an article on A List Apart concerning Dynamic Text Replacement, and it sounded very cool, and pretty straightforward.

After poking around on the WordPress support site (here), I discovered that a plug-in for this already existed. Off I was to Huddled Masses to get the Automatic Images for Headlines plugin. Looked like a slam-dunk, and I thought I would be running this on Sunday. Not so…..

Here’s what it took to finally get it all working. What a path!

I plopped the plugin where it was supposed to go, configured a few variables it needed, and tried to run with it. Everytime it loaded a page, the page would stop at the first substituted title. After putting some echoes in the code, I discovered it was stopping when trying to run ImageTTFBBox. For some reason, PHP was dying in that routine, with no errors and no advancement beyond that point.

I looked up that function at php.net, and noticed it required the GD library and FreeType library. I didn’t think I had them, and found somewhere that there was gd functionality included, but I had to compile with an option flag turned on. Since I was gonna have to recompile anyway, I figured I would also upgrade PHP to 4.3.8 along the way.

I pulled down PHP 4.3.8, gunzipped, untarred it and then:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-gd

Configure complained that zlib was required. I thought it looked like SuSE had installed zlib 1.1.4-225, but I couldn’t find it on the path, so I got 1.2.1 down from gzip.org. I did the standard dance (./configure, make, make install) and then recompiled PHP 4.3.8:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/local/include/zlib.h --with-gd

That got me a little farther, but I still got an error cannot find libz
found on topology.org to configure zlib with:

./configure --prefix=/usr

Did make and make install, and tried to configure php without the with-zlib option. It failed again requiring zlib, so I re-configured PHP with:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/lib --with-gd

This still failed, so I tried:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/lib/libz.a --with-gd

This still failed, complaining that:

checking if the location of ZLIB install directory is defined... no
configure: error: Cannot find libz

I then tried compiling zlib:

./configure --prefix=/usr/local
make
make install

And then reconfigured PHP:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/local --with-gd

This configure worked! Did a make and make install. Checked php –version and it shows 4.3.8 — good!

The next question was did WordPress still work? Well, after a cold stop and restart of Apache (graceful did not work, for some reason — not quite sure why), I was able to hit my pages.

However, the headlines show with problems, but at least I’m not getting “server does not support PHP image generation” messages on my pages. Obviously, I still had some kind of problem with the libraries for PHP.

I found somewhere that someone else had trod down this path, so I duped their work in my PHP configure:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/local --with-gd --with-jpeg --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/lib

I still didn’t get my pretty headlines, so I figured I would start from scratch, inspired by some info once again from php.net. I grabbed jpeg v6, gd 2.0.28 and freetype 2.1.9 from their respective locations on the net.

Did the standard stuff to jpeg v6 and freetype: ./configure, make, make install. For gd, I did the following:

./configure --with-jpeg=/usr/local --with-freetype=/usr/local --with-png=/usr/local
make
make install

Then I reconfiged php 4.3.8 with:

./configure --with -apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib=/usr/local --with-gd --with-jpeg --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/lib

Alas, there were still no pretty headlines. Something somewhere implied that xpm needed to be included in my configuration of PHP, so I pulled down xpm 3.4. As seen elsewhere, I did the typical stuff (./configure, make, make install) and moved the directory with the goodies to /usr/local/xpm.

I needed to reconfigure gd with xpm, so;

./configure --with-jpeg=/usr/local --with-freetype=/usr/local --with-png=/usr/local --with-xpm=/usr/local
make
make install

Now, I needed to reconfig php:

./configure --with-apxs2=/www/apache/current/bin/apxs --with-mysql --enable-exif --with-zlib-dir=/usr/local --with-gd --with-jpeg=/usr/local --with-jpeg-dir=/usr/local --with-png=/usr/local --with-png-dir=/usr/local --with-xml --enable-track-vars --with-tiff-dir=/usr/lib --with-freetype=/usr/local --with-freetype-dir=/usr/local --with-xpm=/usr/local --with-xpm-dir=/usr/local
make
make install

WOOHOO!!!! It finally works!

Now to play with fonts and colors -- mind the dust!