I am a great fan of using WordPress not only to run blogs, but also as a Content Management System. The team behind WordPress ensure that the software is updated regularly, adding new features and bug fixes. When I came recently to updating this blog to version 3 of WordPress, I encountered an issue that I hadn’t seen before with WordPress and in particular on the 1and1 hosting that it uses. To be more precise it is the way 1and1 (oneandone) handles or parses php files

Error 500 – Internal server error
An internal server error has occurred!
Please try again later.

It didn’t take long to track the problem down to the way 1and1 hosting parses php files. By default 1and1 will use PHP version 4 to parse scripts. It seems that WordPress 3 requires part of its program to run through PHP5. To tell 1and1 hosting that you want php files parsed with version 5 of PHP, follow the steps below by creating an htaccess file with some special commands

  1. Create a new text file, using Notepad
  2. Add the following code to the top of the file, save it, and name it as htaccess.txt
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
  1. Upload your modified htaccess.txt file into your wordpress root folder using FTP
  2. Rename the htaccess file, using your FTP program, from htaccess.txt to .htaccess (notice the dot before htaccess, that is important)
  3. Go back to WordPress and test
  4. Note that you may already have an .htaccess file sitting in your WordPress root folder, if so, FTP the file from your 1and1 hosting to your computer and add the two lines above to the end of the htaccess file, then upload again, overwriting the original htaccess file. (you may want to rename the original htaccess file before overwriting, just in case)

From now on any php scripts that are served out of your WordPress root folder will be processed by PHP5.

This is a common problem with 1and1 hosting, but one which is easily solved and not only works for wordpress but for any other script, such as content management systems, social networking scripts (elgg) etc.