Top

Troubleshooting WordPress: Common Fatal Error Messages and How to Fix Them

May 27, 2011

There are some WordPress problems that crop up again and again. And there are few people better equipped to deal with them than the many Support Pros across the WordPress Universe. I’ve teamed up with WPMU DEV’s awesome Mason James, big-boss of our own Support crew, to look at some common WordPress problems. Over the next few weeks we’ll look at how you can address them.

Today we’re going to look at some of the common error messages that appear repeatedly on the WPMU DEV forums.

Sometimes you’ll get an error message, other times you’ll only get a white screen and a lot of confusion.

If your screen is completely white you’ll need to find your error log to figure out what the problem is.

Find Your Error Log

Your error log contains all of the information that you need for troubleshooting your WordPress problems. To find this you’ll need to open your FTP program and navigate to your WordPress folder. In either the root folder or in wp-includes you’ll find a file called “error_log”

If you’d prefer to use Plesk to find your error log you can follow Sarah’s tutorial.

Open up the folder and you’ll see a whole load of messages:

These may look like gobbledygook but it’s actually useful information that can help you to fix your problems.

1) Error Message – there are a number of different error messages which you may have become familiar with. The most common of these are:

  • Cannot modify header information – header already sent
  • Call to undefined function
  • Allowed memory size exhausted

2) Plugin or theme file that you have a problem with

3) The line in the file that has the problem – this isn’t always exact but look around that line and you should find the problem

Now you’ve got your error log, let’s take a look at some of the common Fatal Error messages.

Cannot modify header information – header already sent

This indicates that there are some characters outside of your tags. PHP does not like this. These can be as difficult to spot as something as innocuous as an extra space can cause the problem.  Here’s my error:

Warning: Cannot modify header information - headers already sent by (output started at /home/tinkerwe/public_html/wp-content/plugins/facebook-send-like-button/fgb.php:1) in /home/tinkerwe/public_html/wp-includes/pluggable.php on line 897

Let’s break this down:

a) Warning: Cannot modify header information – headers already sent

I’ve got some characters somewhere that are causing problems.

b) There is a problem on line 1 of the Facebook send like button

Let’s check out line 1 of the Facebook-send-like-button:

Argh! There’s a load of spaces –who put them there?!?! (Apologies to the plugin developer as it wasn’t them ;) .

Let’s delete them:

Save the file.

Let’s see if the site is fixed:

W00t!

Call to undefined function

This error means that a plugin or a theme expects something to be there which isn’t – hence the undefined function. It could happen for a number of reasons:

  • An error during auto-upgrade. If this happens you should upgrade manually
  • An error during auto-install. Like above reinstall manually
  • A plugin or theme that is incompatible with your version of WordPress. This could happen with an older version of WordPress with a new plugin. Or perhaps you’re trying to install a plugin that is only compatible with Multisite on a single site installation. If it happens following the installation of a plugin use your FTP to disable the plugin.

Check out this error:

Fatal error: Call to undefined function is_post_type_archive() in myrootdomain/_sites/dcambrose/wp-content/plugins/qa/core/functions.php on line 24

This error is telling me that the QA plugin is making a call to a function is_post_types_archive but that it isn’t there.

Solution?

Access the plugin via FTP and either delete it or rename the folder

Go back to your site, refresh, and it has returned!

The problem here is that the Q&A plugin isn’t compatible with any version of WordPress prior to 3.1. In order to ensure this doesn’t happen you need to check whether a plugin or theme is compatible with your version of WordPress.

Fatal Error: Allowed Memory size exhausted

This error occurs when the amount of memory allocated to WordPress isn’t enough to perform the task that you want.

Here’s mine:

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 6144 bytes) in C:\xampp\htdocs\wordpress\wp-includes\wp-db.php on line 1508

To fix this error you need to increase the amount of memory that WordPress can use.

To do this you can either edit wp-config.php or your php.ini file.

To edit wp-config.php add the following line:

define('WP_MEMORY_LIMIT', '128M');

or whatever amount you want.

Editing your php.ini file is a bit more complicated as it’s not a file that comes with WordPress but is part of your hosting account. You should check out this tutorial on increasing your memory limit using php.ini.

Because this plugin/widget is provided free of charge, I simply ask you to link back to Pressography.com in a post on your blog, or from one of your sites. It doesn't need to be anything fancy - just a note saying that you're using it, and whether or not you like it. However, there is no requirement that you do this, you're free to use the plugin regardless.

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.