Smashing your desk in frustration? Is an annoying error causing you to fall out of love with WordPress?
It’s a wonderful platform both for blogging and CMS, but no software is without its flaws. This article overviews 3 of the most common WordPress errors, providing handy solutions to the ‘The White Screen of Death’, ‘Internal Server Error’ and ‘Error Establishing Database Connection’.
Some of the tips contained within this article can be applied to other errors, so even if your site hasn’t fallen over, you might learn something useful for the future…
1) The white screen of death
One of the most infamous errors, it has resulted in broken crockery across the globe. It will most likely be down to one of three things:
- Exhausted memory
- A plugin
- A theme
If the screen occurs on different sites, that use the same host, then you can safely assume that the issue lies with your hosting provider. If not, then you can be sure that the problem is with your site itself:
Exhausted Memory
Reaching the memory limit is often the problem behind this error. To increase your memory, access your wp-config.php file — navigate to the root file of your site using an FTP client or the File Manager in your hosting panel. Within the main php tag you will need to add a line of code, which will increase your memory limit to 64M:
define('WP_MEMORY_LIMIT', '64M');
It’s possible to go higher than 64M, but it’s dependent on your server so 64M is generally a safe amount. Maybe increasing the memory didn’t help, or you already have an even higher limit than 64M? The issue could then be down to a plugin, or your theme.
Plugins
If you have access to the dashboard then troubleshooting plugins is simple. Simply click on ‘Plugins’ and disable the most recently installed one, if this doesn’t help then you can deactivate all of your site’s plugins, select all the plugins using the topmost tick box and choose ‘Deactivate’.
If you don’t have access to the dashboard, then an alternative way of testing plugins is via FTP. If you have an FTP client, then simply navigate to the relevant directory. Open up ‘wp-content/plugins’, which will contain all the plugins you’ve installed. Simply rename the ‘plugins’ folder slightly, maybe add a word at the end – so ‘plugins’ becomes ‘plugins-test’.
Alternatively you can also use this same methodology to rename the folders of the individual plugins, which will test each plugin individually – rather than all of them at once. If you’re happy to reinstall your plugins, simply rename the folder back to its original name.
If a plugin is at fault, there could be one of many reasons. The best approach is to simply remove it and find a plugin that achieves a similar result. Try and find a more recent plugin, or one that has been updated so that it won’t cause issues.
Themes
If troubleshooting your plugins hasn’t helped, then annoyingly it could be your theme. The first thing to do is backup your theme folder. You can then simply delete your theme, and WordPress will install a default theme. If you’ve determined that the theme is at fault, then you will want to look at your theme’s functions.php file. Some poor coding may be the issue, if you’re not confident in adjusting this yourself, then perhaps contact the theme’s author. Purchasing a trustworthy theme whose author offers support is always advised.
Still thumping the desk in frustration? There is another method that might help – Enabling Debug mode.
Enable PHP debugging
If the solution above haven’t fixed your issue, then you will have to dig a little deeper. The process outlined below will help to identify your problem. However, fixing the problem once you’ve discovered what it is might require some more advanced skills.
Firstly, open up the wp-config.php file. Then locate the following line:
define('WP_DEBUG', false);
Place ‘//’ at the start, so that it becomes
//define('WP_DEBUG', false);
The above is now commented out, for the next step paste in the following code directly below the above line:
define('WP_DEBUG', true);define('WP_DEBUG_LOG', true);define('WP_DEBUG_DISPLAY', false);@ini_set('display_errors',0);
Now this is where you will need to have some knowledge of coding. The steps you’ve just taken will result in errors being sent to a file named error.log (found in the wp-content folder). If you’re having trouble finding this, it might be that you don’t have permission to create this file. Simply create a new error.log file and give it permission of 666.
Open up the file in a text editor and check for PHP errors. If this is something you don’t understand or aren’t confident with, then it’s advisable to seek some help.
2) Internal server error
If you’ve received a 500 internal server error, then you might not be aware of the really bad news – it could be one of many problems! So make a highly caffeinated hot drink, take a breather, and be prepared for some more troubleshooting. The good news? Some of the methodology is the same as the previous section.
Plugins or theme
Refer to the ‘Plugin’ and ‘Theme’ sections of the previous section. The troubleshooting methodology is exactly the same.
Exhausted memory
Again, this process is the same as the previous section.
Bad .htaccess
Not any of your plugins, or your theme? Time to check if your .htaccess file has become corrupted.
Firstly rename the file — again just add ‘temp’ or something similar on the end. Can’t see the file? Then you’ll have to make sure that you’ve enabled ‘viewing of hidden files’. How to achieve this will depend on your FTP client, but it will be fairly simple. For example in Filezilla, simply select ‘Server’ from the top and then select ‘Show hidden files’.
Now onto the next step, firstly go back to the WordPress admin area. Navigate to ‘Settings – Permalinks’, and then reset your permalinks. You’ve now generated a new version of the working file, so you can check to see if the problem has been fixed.
Enable PHP debugging
This has also been covered in the above section, so once again, scroll up.
3) Error establishing database connection
There could be several reasons for this error. It is commonly a server error, but it might be that you’ve simple changed your database login details.
It’s important to establish if you receive this error on both the front and back end of your site. If you see the same error message in the back end (wp-admin) – ‘Error establishing a database connection’, then you can skip the next step.
However, if you’re seeing a different error message which includes something along the lines of ‘…..The database may need to be repaired…’ then you should add the following to your wp-config.php file:
define('WP_ALLOW_REPAIR', true);
Then visit this page on your site: http://www.examplesite.com/wp-admin/maint/repair.php
You’ll then be able to see an option to repair the database, once you have repaired it, make sure you remove the above code from your wp-config.php
WP-Config file
Have you changed your root password, or database password? If so, then you’ll also have to change this in the wp-config.php file. So jump into your wp-config.php file and make sure the information is correct.
define('DB_NAME', 'database-name');define('DB_USER', 'database-username');define('DB_PASSWORD', 'database-password');define('DB_HOST', 'localhost');
It’s important to verify what your DB host value is, so that the final line is correct. In the majority of cases it will be localhost, but do some research just in case. If you’re running WordPress on a local server then replacing localhost with the IP address might fix the problem.
Communicate with your hosts
If you notice this error when your site receives a large amount of traffic, then the fault could be with your web host provider. There are methods that allow you to see if MySQL server is responsive, but your web host will also be able to tell you. Maintaining communication with your web host is always a good idea anyway, so why not give them a call?
Further solutions
In the majority of cases the above solutions will provide you with a fix to your error, however there are always rarer issues that may have caused similar problems. If you’re still struggling then I recommend visiting this page as a good starting