About the author.

Welcome to The blog of whall

Come on in and stay a while… laugh a little. Maybe even think. Read more...

Hi, This is Wayne. This is my site, my stuff, my blog, blahblahblah. The site itself is powered by WordPress and the Scary Little theme. I thought it was cool, and I still do.

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.

In short,

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.

Enjoy 🙂


MySQL upgrade from 4.0 to 5.0 at 1&1 (1and1)

For this, you need SSH access to your account. If you don’t have SSH access, then you’ll need PHPMyAdmin access and your compressed database size needs to be < 2MB, AND you’ll need to look elsewhere.

SSH into your host, and cd to wherever your blog is hosted. For a lot of people, this will be ~/ (home directory once you login). For me, since I host dozens of blogs, I create a directory for each blog and have all the WordPress files inside of there.

For this example, assume ~/blog is where the blog is hosted

First, use the 1&1 Control panel to create a new MySQL 5.0 database. This takes a couple minutes, so go ahead and get it started now.

When the DB creation process starts, it will give you four useful pieces of information:

  • Database name (db##########)
  • Database username (dbo#########)
  • Database password (random characters)
  • Database Hostname (db####.perfora.net)

Copy those off somewhere so you can use them later. Feel free to try to type them in by hand, but if you ask me, that’s just asking for trouble. Open up notepad or vi or your favorite text editor and copy off those 4 values.

You should note that the above values represent the NEW MySQL 5.0 database.

Now we need to find out what the OLD MySQL 4.0 database values are. Do the following:

(uiserver):~/blog >grep DB wp-config.php
define('DB_NAME', 'db1234567890');
define('DB_USER', 'dbo1234567890');
define('DB_PASSWORD', 'somepassword');
define('DB_HOST', 'db1234.perfora.net');

Now we have name, username, password and hostname of what your blog currently runs with.

We will first use the mysqldump command to make a backup of the 4.0 database and use the mysql command to populate the empty 5.0 database. You should take note that these commands are different by 4 characters.

First, the mysqldump command:

Template:
mysqldump -h (DB host) -u (DB user) -p (DB name) > ~/backupfile
(uiserver):~/blog > mysqldump -h db1234.perfora.net -u dbo1234567890 -p db1234567890 > ~/blogbackup-4.0-2010-05-06.sql
Enter password: <type in password here, not visible>

Note that I used the database values from the 4.0 database. -h means host, so we’re putting the DB host value right after it, -u means user, and -p means “ask for the password when running”. Don’t think that -p means “put the password on the command line”. I’m redirecting (with the > character) the database backup to a file in my home directory (~/) called blogbackup-4.0-2010-05-06.sql. I like putting dates on my backups, and I want to remember later that this was from a MySQL 4.0 database in case I need it later.

Once your new MySQL 5.0 database is ready (check your 1&1 Control Panel for status – it should say “ready” instead of “setup started”), you can now put your 4.0 database into it.

Note we’re using the mysql command, not mysqldump, even though the syntax is identical. Don’t forget to switch the redirection sign > to <, and don’t forget to use your new MySQL 5.0 database values!

Template:
mysql -h (DB host) -u (DB user) -p (DB name) < ~/backupfile
(uiserver):~/blog >
mysql -h db5678.perfora.net -u dbo9876543210 -p db9876543210 > ~/blogbackup-4.0-2010-05-06.sql
Enter password: <type in password here, not visible>

Please please please – don’t type this command with your old MySQL 4.0 database values. Use the NEW database you created.

Once that’s done, you edit your ~/blog/wp-config.php file and change the four lines of host, user, name and password to reflect your new MySQL 5.0 database values.

Your blog should work like it used to. If it doesn’t, you can always change your wp-config.php values back to your 4.0 values and retrace your steps to see what went wrong.

And lo, the people did comment thus:

22 Comments

  1. I tried 1&1 for about 10 minutes. It was awful, even with the 3 years for free offer I decided to find a good host.

    I’m a big fan of CPanel, since it avoids the whole PHP4/5 issue fairly easily without making any .htaccess changes. If there’s an issue, just select PHP5 manually in CPanel for that domain. Done. And no weird wordpress issues over the years on any of the domains I’m hosting. My host SURPASSes any of the others I’ve tried.
    .-= Nobody™´s last blog ..A-Rod Goes Deep, Wang Hurt =-.

    • whall says:

      N0b0dy – I enjoyed our conversation on Facebook re: this comment. In short, 1&1 still satisfies my needs, one of which is extremely low price.

  2. Dave2 says:

    Fortunately, I never have to deal with stuff like this at my web hosting company. Everything “just works” when it comes to keeping my apps, blogs, and site pages up-and-running.

    Which is nice and everything, except they have the absolute WORST uptime record of any place I’ve ever been. I get more “emergency service notices” than I do billing statements. My blog goes down so often than sometimes I wonder if it even exists. Using any app that accesses a database is so painfully slow that I can get a “pages timed out” just trying to approve a single comment. Tech support’s idea of “help” is to tell me that they “aren’t seeing a problem on our end” or “we’re working on it” or my most-favorite… “it must be your internet connection.” Never mind that I access my site from ALL OVER THE WORLD and have the same problem from Seattle to L.A. to Chicago to Orlando to New York to London to Amsterdam to frickin’ Prague… it’s MY problem.

    So, if you get Google love for web hosting company recommendations because of this entry, I am happy to add my two cents: AVOID MEDIA TEMPLE “GRID” HOSTING AT ALL COSTS! You’d think the premium price they charge would be assurance of excellent hosting, but you don’t always get what you pay for.

    I wish I could say that rant has made me feel better.

  3. marilyn says:

    I don’t know what a Tom Tom is but I WANT ONE.
    .-= marilyn´s last blog ..And Again with the Asterisks =-.

    • whall says:

      marilyn – The closest thing to GPS I have is my iPhone 3GS. I’ve still never had any GPS device (yeah, I know; my geek badge is in danger)

  4. Sybil Law says:

    Yay!
    I do not understand any of that, but yay!!

  5. Avitable says:

    I get a 500 Server error on my business blog every time I try to do any action, even though it still processes properly. I wonder if this might help with that.
    .-= Avitable´s last blog ..My Interview with that Chinese guy who killed all the kids. =-.

    • whall says:

      Ahmoo – that’s EXACTLY the symptoms I had, both on my blog and some blogs I hosted for others. Most of the time the site would work (see posts, see the dashboard) but when you try something, like edit, or update a plugin, it would give the 500 error. Give it a shot!

      For you, no charge.

  6. thank you so much. i was about to dump 1&1 because i got so many internal server errors. your fix is awesome and i implemented it on all my sites. now i can automatically upgrade my wordpress installs and use plugins that i could not use before. plus my theme issues went away too.

    • whall says:

      car dealerships – I was very close to marking your comment as spam due to the name, url, etc… but your comment was on point and appreciated. You win this round…

  7. Hi whall. What is interesting is when I called 1and1 about my four sites they told me I am on php4. In mysql in the 1and1 cpanel it shows “MySQL5.0” ready for all my sites. It has me scratching my head but I have the same issues as you previously did and it is very frustrating.
    Here is how my .htaccess file looks like:
    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress
    —I was told to just add this to it from 1and1 and i was golden: AddType x-mapp-php5 .php

    I have no clue where it should go if it is outside the brackets or before. I appreciate your help if you can give me some more direction.

    Best:
    Michael

  8. Craig says:

    Thanks, worked like a charm for 1and1.com shared.
    These tree lines:
    Options All -Indexes
    AddType x-mapp-php5 .php
    AddHandler x-mapp-php5 .php

  9. Phelan says:

    Thanks for posting this article on 1and1 hosting and the WordPress update bug. We were baffled by why WordPress wasn’t updating plugins or to the newest version when working on our clients’ site on 1and1.

    I’m really glad your .htaccess hack just works. I’m tired of reading through long blog posts about solutions, implementing them and they still don’t work. So, thanks again for posting something useful.

  10. Anna says:

    I have learned a lot about Wordress, SQL and databases in the last couple of years, and have also learned that all hosts are not equal! I am now using a cPanel host but create all my databases manually, so I name the database and the user, and randomly generate the password. I feel that gives me more control and I am less likely to run into problems if the db crashes and I need to restore it. I haven’t run into the version problem above yet, so I will probably stick to Hostgator!

  11. Paul says:

    As helpful as the article was, and I agree on 1and1, for the record…I cannot help but commenting on Darth Vader. That is absolutely hilarious. It was a random smile after reading the article.

  12. Avery K. says:

    Paul took the words out of my mouth. I appreciated the fix, but the video was particularly entertaining. Thanks for both!

  13. Ben W. says:

    I’m a 1&1 fan, glitches and all, but it’s all that I know. My friends tell me it’s never too late to switch, but if it ain’t broke…

  14. I’m interested in transferring my journals to a blog format, but I don’t know much about web hosting. I don’t really know anything. Would you recommend 1&1 for a beginner?

  15. I was using a cheap hosting site for the last year and have been relatively happy until recently. Half a dozen of my sites have been down for 2 weeks now—I guess you get what you pay for. I appreciate you recommending 1&1 hosting, I just checked it out and I’m probably going to make the switch. Thanks.

  16. I tried several different hosting sites even 1and1 hosting. When I first started I didn’t know what to really look for in a good hosting site so I settled for one that presumable gave good tech support. I’m using HostGator now, and I love it. Thanks for the post.

Want to comment?

Hey, we all want to share our voice. And I particularly love comments, especially if you took the time to read my blog entry. I'll take the time to read your comment, I swear! But due to spammers, robots, and the fact that I want my blog to be PG rated, I need to approve the comments. This should be same day, but please don't get mad if it takes me a while to approve the comment.







Comment:


PLEASE help keep this blog family-friendly by refraining from profanity and vulgarity.


CommentLuv badge


Admin
tsk tsk

Ajax CommentLuv Enabled 336ad6ab990e8080f1c0ad1f892428a0