I decided I finally wanted to track down why I couldn’t get the thumbnails working on WordPress. I always get the message “File type not supported. Thumbnail not created.” even when the filetype is supported. I run a standard Debian stable system, with a backport of MySQL, so my first assumption was that it should work. A long weekend is a good chance to try to track down these things, especially when it’s raining as much as it is this weekend in Vancouver. Of course, I start at the WordPress support forums. This leads me to try
apt-get install libgd2; the thumbnails don’t work. As a next approximation, try
apt-get install php4-gd2; this also doesn’t work.
I dig a bit deeper in the forums and find that a newer version of PHP might solve the problem; the Debian stable version is 4.1.2 and a version > 4.3 is recommended as the GD library is included by default. The other advantage to upgrading PHP4 is that there are quite a few security holes fixed in version 4.3.9 and up; these may have been backported to 4.1.2, of course. So I look in backports.org because I already know how to use those; no newer version of php4 there. Next I try dotdeb.org; this backport site has a newer version of PHP4 and a newer version of MySQL. I add the magic line
deb http://packages.dotdeb.org ./ to the
/etc/apt/sources.list file. I also change the pin priority in the preferences file to use dotdeb.org rather than backports.org. This upgrades my MySQL to dotdeb’s 4.0 version nicely, but doesn’t touch the PHP4 installation. Seems odd to me since they should both be upgraded in the same way, I would have thought. Edd Dumbill (Debian guru) gives me a couple of other things to try in the preferences file; nothing seems capable of raising the priority of the dotdeb php4 install over the current stable installed version. Edd suggests installing each
.deb by brute force; that breaks on unmet dependencies.
So I think about installing the unstable version of PHP4; maybe that will work better. I set up the pin priorities in the
preferences file, and use
apt-get -t unstable install php4. It threatens to install lots of things, so I decide to install a little at a time and make sure nothing breaks, or at least ensure I know what has broken if it does. First off, I make backups of
access.conf, the firewall script, and the PPPOE settings. Just in case. Not that I’m paranoid or anything.
- I install the unstable version of
libexpat1; this installs
libc6and talks about having to restart the X11 server. Since I’m not running X, this isn’t a problem. Then it decides it also needs to restart apache but the restart fails so I have to start apache by hand. For a while it looks like that failed too and I’m mentally cursing but it does eventually restart.
- Then I decide, rather than the piecemeal approach, to do the full install with
apt-get -t unstable install php4. As a side-effect it looks like I also get perl updated to 5.8.4, and it upgrades apache (just as well I saved those conf files!). The install script tells me about changes to apache config files, which has me a little worried… I decide to install the package maintainer’s version of
httpd.confand add in any needed changes later. Everything seems to keep on running afterwards, though, so this upgrade was better than the last
dist-upgradeI did, which didn’t apply my changes to
phpinfo.php shows that I have php4.3.10 installed on my system; time to try out the thumbnail functionality. It still doesn’t work. Reinstall
php4-gd2. Thumbnails still don’t work. Try
apt-get -t unstable install php4-gd, which also seems to uninstall/reinstall/install a whole bunch of packages. I console myself that I’m half-way to sarge, if and when that version of Debian ever makes it to stable. Hmm, the install script just asked me what size paper should be the default on my system. I guess it has some reason for wanting to know.
Since the thumbnail generation still doesn’t work, and I have no idea what to try next, I decide to give up and post on the WordPress support forum. I hope someone there knows what the problem might be! In the meantime I create the thumbnail I need using Imagemagick’s
convert function. This takes one command line and approximately 0.01 seconds.
Later… on the WordPress support forum someone tells me to search the forums. Since I’d started by doing that (and quoted forum searches in my post), that wasn’t particularly helpful. Then I remember I have SpamKarma installed, which has a captcha script (not that I want to use it, but it should be a good test). The error message on the captcha test page says the GD library isn’t enabled. A bit of Googling turns up the idea that maybe I need to restart apache yet again. I hadn’t thought of this before because the Debian upgrade/install process usually restarts everything that needs to be restarted, including apache. I run
apachectl restart and find I can finally click the magic button on image upload to create thumbnails!
So the lesson appears to be: if in doubt, restart apache. Three times, preferably. Any less just may not work.