I’ve hit my head against the virtual wall (whall?) more times than I can count over the past few years on something that I suddenly “fixed” recently, and I wanted to blog it for the masses.
If you’re running WordPress or any PHP-based application on a host that has both PHP 4.0 and 5.0 installed, append the following to your .htaccess file for that application:
Options All -Indexes
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
As an added bonus, I also detail how to upgrade MySQL 4.0 database to MySQL 5.0 on 1 & 1 hosting (see extended entry below).
I use 1 & 1 for my internet hosting, and have since, oh, 2003 or so. For the price I pay and the service I get, I’m very happy. There have been a few glitches, to be sure, and I’ve blogged about a few of them. But overall, I’ve been a happy camper.
I mention 1 & 1 because on all their shared hosting packages, they install both PHP 4.0 and 5.0. Ever since I can remember, I’ve had the dreaded “Internal Server Error 500″ on a few things on my blog, like exporting my blog to XML as a backup, or similar tasks. Sure, I can always do the manual MySQL backup because I’m a geek, but it annoyed me that I couldn’t do the XML backup. Also, some plugins just wouldn’t work right, and auto-upgrade almost NEVER worked.
This inability to auto-upgrade also frustrated some of the people I host blogs for. Yes, I host blogs. For those special few in my life (heh) I will set up, install, configure and host a wordpress blog so they don’t have to worry about it. I typically only have them pay for the domain name ($10 a year or so) and I host the site for free. I host more than a hundred domains, including personal blogs, commercial blogs, non-profit websites, and I use WordPress, Joomla, Drupal and even raw HTML (the shock and awe!), wherever appropriate. It’s not a money maker for me, and I only ask that if someone I host gets wildly popular and makes millions of dollars, that they kindly remember me on my birthday.
On every WordPress blog I hosted, the authors weren’t able to consistently install or update plugins, or perform the auto-update feature inside of WordPress. It would either give that infernal Internal Server Error 500 or it would just hang. So, they’d email me, I’d procrastinate, they’d nudge, I’d forget, they’d ask politely a fortieth time, I’d promise to do it, and then eventually I’d manually upgrade their plugins a year later.
I’m happy to say that the above .htaccess file changes have completely eradicated the auto-upgrade errors, and I can perform the XML backups all day long without a problem. Not only that, but my blog actually seems faster. In case you care, the .htaccess lines tell Apache (the web server running on the host) to use PHP 5.0 to process all the files ending in .php instead of the default of PHP 4.0.
I’d do a happy dance if there weren’t so many adoring fans surrounding me, restricting my movements.
For the big WordPress 2.9 upgrade that I’ve been putting off, I was also challenged by the fact that my personal blog as well as a few blogs I host used the older MySQL 4.0 databases instead of the newer MySQL 5.0 databases. WordPress 2.9 required a later version of 4.0 than 1 & 1 had installed, and I was wary of diving into the “upgrade MySQL 4.0 database to 5.0″ process.
Until last night.
The database upgrade went quite smoothly (this post was most helpful). In fact, I got it down to a science – take the values from the wp-config.php file (database name, username, and host name) and put it into the mysqldump / mysql commands to pull from the old 4.0 database and insert into the new 5.0 database.
My steps, for those interested and the inevitable Google searches that will land here, are documented in the extended version below.
Once I upgraded my MySQL Database to 5.0 and added the .htaccess lines at the top of the post, the WordPress 2.9 auto-upgrade was a cinch. Not only that, but several of the plugins that wouldn’t auto-update updated without issue. It was so easy and fun that I upgraded a few dozen blogs and their plugins as well.
Needless to say, I was quite pleased with myself. I’m celebrating by actually taking time to blog about it so you can be pleased with me, too!
If geekiness of this nature doesn’t please you, then maybe this Tom Tom Darth Vader behind the scenes video will.