Fix “500 Internal Error” in WordPress

I recently upgraded my WordPress installation to the latest version (2.8.6) and started running into issues with uploading images. Every time I tried using the Flash Uploader I would see

HTTP Error.

On trying to use the non-flash browser based uploader, I saw the following:

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

I googled quite a bit and finally found a solution. This error can happen because of quite a few different reasons:

  1. Incompatible plugins
  2. Incorrect .htaccess file contents
  3. PHP running out of memory
  4. Incorrect file permissions
  5. Not using PHP5

Incompatible plugins

Easiest way to find if this is the issue is to deactivate all plug-ins and see if the issue still persists. If it goes away you can activate each plug-in one by one to find the culprit. You can read more on managing plug-ins here.

Incorrect .htaccess file contents

For some people, the issue went away after fixing the .htaccess file contents. You need to ensure that the .htaccess file at root of your website has the following contents:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

You can read more about it here.

PHP running out of Memory

This can happen if you are using some memory hungry plug-ins. You can fix this issue by adding a php.ini file in <wordpresss_root>/wp-admin folder with the following contents:

memory=20MB

You can read more about this at codedifferent.com, where this is explained in more details.

Incorrect file permissions

WordPress can start acting up if the permissions on directories and files in WordPress installation aren’t set up properly. You can ensure that this is fixed by logging into your hosting provider and making sure all files and directories have permissions set to 755.

Another issue that might lead to errors while uploading is certain security issues with files used for uploading. This can be fixed by using Image Upload HTTP Error Fix plug-in. Otherwise, you could edit .htaccess to add the following lines:

#BEGIN Image Upload HTTP Error Fix
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
<IfModule security_module>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
<IfModule security2_module>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
#END Image Upload HTTP Error Fix

Not using PHP5

Even after doing all the above, things weren’t working for me. That is when I came across this post, which explains that the issue could be because PHP5 wasn’t enabled. According to a help article on 1and1.com, fix is to just add the following line in .htaccess file:

#enable php5
AddType x-mapp-php5 .php

This fixed the issue for me!

Hope this helps.

Blog Updated

ok… after a long time, I did some major updates to this blog. Since I had shifted from MT, I had not really made any changes.

Well…. first off I added a couple of things in the sidebar. I have also added a lot of WP plugins. One of the plugins that I have added is Taggerati and it is used to tag posts on the blog. I came across this plugin when I was on Vinit’s Blog. Other than this there are about 10-15 more plugins in my WP, many of which are being used. These are mostly to make life more easy for me rather than make this blog look better for the visitors ;-).

I have started working on a template on top of the kubrick template. I’ll be using the same template then for my website as well as this blog. I don’t know when will I be able to complete that, but I hope I do it soon. I have started to get bored of this already….