Improved WordPress performance, shared hosting and 500 errors

posted Tuesday, February 3rd, 2009 at 7:46 pm by

WordPress, shared hosting and 500 errors

I’d previously mentioned how I’d had problems with WordPress 500 errors when attempting to install plugins. I had put this down incompatibilities between WordPress MU and some plugins, but with a few simple changes to the configuration of the PHP installation on your hosting account, you can quickly improve WordPress performance.

After getting a bit bored with the number of plugins I was unable to install, I decided to do a little research and found this was a similar experience for other WordPress users with 1and1 shared hosting. A quick search and I found a thread on the WordPress forums which bared some resemblance to my own problems.

A standard PHP installation will have a php.ini configuration file containing default settings set by your hosting provider. You can override some of these settings by adding a plain text file entitled php.ini to your WordPress /wp-admin directory. Adding this line of code will allow you to set the memory used by PHP when running scripts:

memory_limit = 128M

One thing your hosting company may have done is restrict the memory used by PHP when running scripts. This reduces load on the server and may have been done for security reasons to prevent badly implemented or malicious scripts draining server resources. I later found that the default settings on 1and1 hosting had been 40Mb, while it would be normal for this setting would be 128Mb.

I found changing this one setting made a huge difference when trying to install some plugins. Previously when activating some plugins, my plugin admin page in WordPress returned a 500 error and I would need to rename the individual plugin’s directory to force its deactivation and enable me to use plugin admin again.

Another way to change the memory allocation would be to add these lines to your .htaccess file:

# Set memory limit
php_value memory_limit 128M

I was still having some further problems with one plugin I was trying to use despite the extra memory. Apparently another thing 1and1 would do is set the PHP to a legacy version by default. I found an article on The Code Cave which shows an easy way to force your server to use PHP5 by adding these lines to your .htaccess file:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

This solved the rest of the problems I was having installing my plugin. The Code Cave describes a good way to test the current settings on your setup which I found quite useful. I also found you can test these settings by installing the WP Security Scan plugin, which provides system information about your setup including the settings mentioned in this post, as well as quite a few other useful security features.

I also found that increasing the memory limit solved a problem I’d being having with the WP-RSSImport plugin I had been using to embed RSS feeds on my site. I was finding the site was returning 500 errors on some occasions which I had put down to badly formed feeds. Since following the steps I’ve spoken about, I reintroduced embeded feeds to my site and up until now haven’t had any further problems.

Ads from Google

1 comment to “Improved WordPress performance, shared hosting and 500 errors”

  1. Buy Viagra

    Buy Unique Pharmacy Today!…

please leave a comment

spacerdotgif comments RSS feed
Please leave a comment

* required fields