WordPress is stable software and operates without issues most of the time. However, at times, things may go a little haywire, and your WP website can refuse to function normally.
Have you ever encountered a white screen after adding some new themes or plugins? Maybe you were just updating your WordPress website and that update now refuses to finish, and your website is in eternal maintenance mode? What about internal server and database connection errors?
If you have encountered any of the above problems and are looking for the solution to them, you have come to the right place. In this article, we shall be taking a look at some of the most common WordPress problems and ways in which we can solve them.
Featured Plugin - WordPress Google Maps Plugin
1. 500 Internal Server Error
Your site was working fine, and then, when you wake up the next day, this is what you find:
The most common cause of a 500 Internal Server Error message is a corrupt .htaccess file. Additional causes can be a conflicting plugin or theme, or even a corrupt WordPress installation.
Sometimes, PHP memory limits may also cause a 500 Internal Server Error. The easiest way to figure out where the problem lies is to check your website’s error_log (many shared web hosts often do not enable full error logging, though). To find out more, you can enable WP_DEBUG and check for error logs. Open up your wp-config.php file, and locate the following line of code:
And change it to:
Since the most likely cause behind the error is a corrupt .htaccess file, let us tackle this one first.
You will need FTP access on your server. Navigate to the root directory of your WordPress installation, and locate the .htaccess file. Rename the file to, let us say, something like .htaccess_old
Now reload your website. If it works, congratulations! You can now generate a new .htaccess file simply by navigating to Settings–>Permalinks in your WP admin panel and re-saving the settings.
You can also try deactivating your plugins and themes because sometimes a 500 Internal Server Error can be caused by a faulty plugin or theme as well. Alternatively, you can try increasing your PHP Memory Limit to ensure that the memory limit is not the cause of the error. You can find detailed instructions regarding memory limits on the WordPress Codex.
If all else fails, you will need to grab a fresh copy of WordPress from the official site, and then re-upload the wp-admin and wp-includes directories.
2. White Screen of Death
As the name suggests, a White Screen of Death means when you access your website, you see nothing but a blank page.
There can be multiple reasons behind a WSOD, the most common ones being compatibility issues with a plugin or a theme. Of course, the “incompatibility” itself can have multiple faces: a plugin may have a conflict with another plugin, or a plugin may not be compatible with the latest version of WP. Similarly, a theme may also experience compatibility issues with WordPress after an update.
The easiest solution is to first isolate your plugins’ directory. To do so, navigate to the root of your WP installation via FTP (assuming you cannot, at all, access your website and all you get is a WSOD), and then head to /wp-content. Locate the folder named “plugins” and rename it (let us say, “plugins_old”). Create a new folder named “plugins”.
This will isolate all your plugins, and if your website works fine, then yes, one of your plugins is at fault. Do not open your plugins page at this point, else you may end up deactivating all your plugins.
Once you have verified that one of the plugins is behind the WSOD, you can copy individual plugin files from “plugins_old” to plugins”, one by one, to check which one is causing the WSOD.
For themes, the procedure is even simpler. Navigate to /wp-content/themes, and then rename the folder of the active theme. Next, open up your WP admin panel, and head to the Themes page. This will cause WP to fall-back to the default theme (Twenty Twelve, Twenty Eleven or Twenty Ten, depending on your WP installation version). You can find detailed step-by-step analysis here.
3. Maintenance Mode Error
Each time you update WordPress to a newer version, it makes a temporary .maintenance file. Problem occurs when the .maintenance file is not removed properly after the upgrade (in many cases, this happens when the upgrade process itself fails to complete successfully).
You will need to login to your WP root directory via FTP. Thereafter, you can locate the .maintenance file and delete it. This will resolve the error.
If, however, you are experiencing difficulties with the automatic update, the solutions are different, and James Dunn has a guide to help you out.
Featured Plugin - WordPress Ecommerce Shopping Cart Plugin
4. Error Establishing A Database Connection
If you get the above error when you try to access your website, it means WordPress is experiencing a problem when trying to access the database.
The direct cause can be an issue with the wp-config.php file — most likely, details related to your database have been entered incorrectly.
However, most of the time, database connection errors occur due to a problem that can be solved only by your web host (especially if you are on a shared hosting server). Most shared web hosting providers keep limits on databases, and if your database crosses the allotted quota, you can receive a connection error. Plus, database connection errors also occur if your web server is down.
Lastly, sometimes a hacked website can also result in database connection issues.
First up, the wp-config.php file. Locate the file using FTP, and open it. You can then go through it to ensure that database details are correct (database name, username, password and database host).
If you think your website has been hacked or compromised, you will have to work towards cleaning it up. You can use Sucuri SiteCheck to ensure that your website is clean — more details about securing a WP website can be found in this article. WordPress Codex also has an FAQ to help you out.
Lastly, if your web server is down or if your database has reached the allotted quota, you will obviously need to get in touch with your web hosting provider.
5. Connection Timed Out
An error that you receive from an overloaded server (or a badly configured server).
It generally happens when the website’s server is too overloaded and is unable to complete your browser’s request. Nothing puts it more eloquently than the WordPress Codex:
The Connection Timed Out error appears when your website is trying to do more than your server can manage.
The first step is to deactivate your plugins. If this cures the problem, try re-activating them one by one to see which plugin is causing the issue. Alternatively, if it is a problem related to your current theme, activate the default WP theme.
You can also increase your PHP memory limit using the wp-config.php file. Open the file, and add the following line of code to it:
This will increase the memory limit to 64 MB. You should note, however, that if you are on a shared web host, you may not be allowed to increase your memory limit beyond a certain point. In this case, you will need to contact your web host to increase the memory limit for you. Also, bear in mind that many shared hosting providers keep the PHP memory limit as low as 8 MB.
Lastly, if you have access to your php.ini file, you can also consider increasing the maximum execution time.
Featured Plugin - WordPress Membership Site Plugin
6. Error 145
Error 145 means that your WordPress database is damaged or corrupted.
The easiest way to repair your WP database is using phpMyAdmin.
Once you login to phpMyAdmin, choose your WP database. You will then need to select the checkboxes next to tables that you wish to repair. Once selected, you can choose the “Repair Table” option from the drop-down menu right below the list of tables.
Note: Always create a backup of your database before making changes to it.
7. Error 28
Error 28 is more of a MySQL error and is not related to WordPress. Even Drupal, Joomla! or other CMS’ websites can experience it.
Error 28 can occur if the cache on your web server is full or if you have too many files in your /tmp directory.
If you can, then try to empty your /tmp directory. Alternatively, you should contact your web host to help you resolve the cache related issues.
8. Warning: Cannot Modify Header Information — Headers Already Sent
Sometimes, you may encounter an error that goes along the lines of: “Warning: Cannot modify header information — headers already sent by (output started at /path-to-something-directory/some-config-file:xyz )”.
This error is caused by the unrequired spaces in the mentioned WordPress file (generally, it is the wp-config.php file). Naturally, you will need to edit the concerned file to remove the unnecessary whitespaces.
Download the file that is mentioned in the error (say, wp-config.php). Open it using an editor of your choice, and then ensure that there are no spaces either before <?php or after ?> tags. Overall, the first letters of the file should be <?php and the last letters should be ?> (with absolutely no spaces between ‘?’ and ‘<’ or ‘>’ either).
As already mentioned, most of the time this error happens due to spaces in the wp-config.php file. It can be some other file too, though — just read the error carefully because it specifies the file name and the path to the concerned file.
9. Warning: File_Get_Contents
An error such as this one:
Warning: file_get_contents (http://www.url.com/url) [function:file-get-contents]: failed to open stream on line xyz
Most of the time, such errors occur because your web host has strict security settings in the PHP configuration (“security” not as in to prevent hacks, but to prevent overuse of server resources, etc.).
If you have access to php.ini file, you can resolve the error yourself. Open the file, and locate the following line:
allow_url_fopen = Off
Now change the “off” value to “on”, as follows:
allow_url_fopen = On
If you do not have access to your php.ini file, you will need to contact your web hosting provider and ask them to enable allow_url_fopen. Also, if this error is followed by a message such as “failed to open stream: no such file or directory in…”, it can mean that the mentioned file is either missing or not readable (look for it in the specified path, and if you find it, check its file permissions).
There you have it — solutions to the most common WordPress errors! Got an error message or a solution of your own that I missed? Share it in the comments below!
Featured Plugin - WordPress Infinite SEO Plugin
Photo: vector warning sign from BigStock