How to Fix Typical WordPress Errors

Posted on by Joel Parks | Updated:
Reading Time: 6 minutes
WordPress logo

Let’s face it. At some point, while running your WordPress site, you will run into issues and errors and may ultimately have to ask yourself, How Do I Fix My WordPress Site?

A backup & restore may not resolve your issue, and a plugin may not display itself as the source of your problem, at least not immediately. It's hard to tell exactly what is causing your site issues just by looking at it. This can get pretty serious in some cases and can range from a large variety of issues. In this tutorial, we will cover the basics of troubleshooting problems with your WordPress installation to correct common issues seen with WordPress. The first place you need to look for the source of your problem is within the error log.

Where Can I Find WordPress Error Logs?

The most common or likely seen error log used within WordPress investigations does not actually stem from WordPress but rather from your PHP installation on the server. The php.ini file used to control PHP settings for your site will determine if and where the error log is reporting. If this is enabled you can usually find the error log in the directory (or folder) of your WordPress installation. In most cases, this file is titled error_log but is dependent on the setting in the php.ini file. You can also find the WordPress PHP error log (if enabled) within the wp-content folder in a file called php.error_log. If you see neither of these and your site is not loading properly, you need to enable debugging mode or enable PHP logging in your php.ini.

How Do I Enable WordPress Debugging?

You can enable debugging for WordPress within the wp-config.php file. This is essential when trying to determine why a site is no longer loading or is erroring. You may never understand why a site does not load without seeing the errors generated. To better see what is occurring simply edit the following line within your wp-config.php file:

define('WP_DEBUG', false);

And change the false to true:

define('WP_DEBUG', true);

Changing the value to true enables debug mode and will display any errors in the site code directly on the page. This can be useful when trying to track down site issues or to see if upgrades have created any new issues.

Modifying PHP Versions

If you change PHP versions and the site no longer loads this method will tell you why. The wp-config.php is also the location where you can enable the WordPress PHP error log and log directly to a file rather than printing to the screen. You can do this by adding the following code to the wp-config file:

define('WP_DEBUG_LOG', true);

This code creates the WordPress PHP error log (php.error_log) if errors are present and are being generated. You can find this file within the wp-content folder of your WordPress installation. You may not see this error file if errors are not being generated so the lack of presence, after enabling this setting, may mean no errors are being reported. For instance, if your .htaccess file has a syntax error the php.error_log will not show the error because it is not a PHP related error.

Enable PHP Error Logging

If you would rather enable PHP error logging you can add values to the php.ini for the domain or via the .htaccess file if your configuration supports them:

Open your site’s php.ini file. If you are unsure where this is located, you can use a phpinfo page to show the location or you can also run the following in command line:

cpUser=`pwd | cut -d/ -f3`; for i in `pwd`; do touch $i/phpinfo.php; chown $cpUser. $i/phpinfo.php ; echo "<?php phpinfo(); ?>" > $i/phpinfo.php; done

Create PHP Info Page

Manually create a phpinfo.php file within your website's public_html folder, utilizing the following code.

 // Show all information

After adding this code to the file, access this file via a browser at the location you created it. You will find the php.ini path under Loaded Configuration File:

With a PHP info file, you will find the php.ini path under Loaded Configuration File

Once you find this location, edit the file and add the following code if it does not exist:

;;; log php errors
 display_startup_errors = false
 display_errors = false
 html_errors = false
 log_errors = true
 track_errors = true
 error_log = /home/USER/logs/error_log
 error_reporting = E_ALL | E_STRICT

You can change the path for error_log to wherever you want this to be stored within your user's home directory. The WordPress install is bound to the same access rights as the user installing it so it will not have the permissions to write outside their home directory.

On older setups you can change the logging information via .htaccess if your configuration supports php_flags (using DSO aka as Data Source Object)

# log php errors
 php_flag display_startup_errors off
 php_flag display_errors off
 php_flag html_errors off
 php_flag  log_errors on
 php_value error_log /home/path/logs/error_log

Most likely newer and up-to-date configurations are not using DSO and you will need to modify this via the php.ini file.

How to Read Error Logs

To understand how to read the output of these logs look at the following entry:

[09-Sep-2018 22:57:20 UTC] PHP Fatal error:  Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in home/USERNAME/public_html/wp-content/plugins/wordpress-seo/inc/class-wpseo-meta.php on line 477

You can see the date and time stamp followed by the general message and path this stems from. This tells you most of the details you will need to determine where the problem lies. You can see from the timestamp of this error when the error is occurring and if that relates to the current issue or if it was a different error. The path will usually show if this stems from a plugin or theme and the location of the software generating the error. This will even display the line in the document or file that triggered the error which can be further reviewed by your website's developer.

What Are Some Common WordPress Errors?

Fatal Error

The "fatal error" is the most common type of error seen and the cause can vary from coding, like "undefined function", indicate the function and problematic line of code to memory errors (like the one used in the above example). This usually occurs when the server has run out of memory or the PHP memory limit is not set high enough to run the code's requirements. To fix these errors you may need to update software (themes and plugins usually) as it may be using deprecated code and or functions. You may also need to increase the PHP memory limit or locate any heavy resource usage on the server that may be consuming memory.

Error Establishing a Database Connection

This generally means there is an issue with the database in use or the configuration of your WordPress setup. This could mean your database is corrupt or the configuration settings used in your wp-config are not correct or have been modified. Check your wp-config file has the correct credentials and syntax to ensure your database can communicate with your WordPress files. You may also see this error when the server is under a heavy load, or the MySQL service is down. You'll need to investigate resource usage on the server to determine why.

File Not Found

A standard 404 error means your server could not locate the file being called by the software in use on the domain. This usually occurs when ownership or permissions are incorrect, the file path is called incorrectly or the file is completely missing.


WordPress can sometimes run for a while without issue but some common errors can be solved with a little bit of background. As always our helpful support experts are here to assist with any WordPress-related errors. Should you need assistance with troubleshooting your WordPress installation, our sister brand, Nexcess, offers a Managed WordPress hosting platform with WordPress error experts to investigate any issues.

Talk to a Specialist Today!

We pride ourselves on being The Most Helpful Humans In Hosting™!

Our Support Teams are filled with experienced Linux technicians and talented system administrators who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.

Should you have any questions regarding this information, we are always available to answer any inquiries with issues related to this article, 24 hours a day, 7 days a week 365 days a year.

If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone at @800.580.4985, a chat or support ticket to assisting you with this process.

Avatar for Joel Parks

About the Author: Joel Parks

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article