Basic WordPress Troubleshooting (Database Connection and Error Logging)

This guide will walk you through some of the steps you can take first to get your site back online. WordPress issues could be related to a plugin, theme, or update that was recently applied.

Our primary job is to ensure the infrastructure that keeps your website online and running smoothly. If you're facing issues with applications like plugins or themes, a WordPress developer would be the best person to help, as they have the specialised skills to troubleshoot and manage your WordPress site. This guide is here to assist you with some troubleshooting steps you can try on your own, if you'd like

1. Make sure that you are not being blocked by a firewall

Before starting, make sure the issue persists across devices and networks. If this issue only impacts the devices on your home network, please review the following guide: I can't access my website

2. Check your database connection

WordPress errors are often caused when WordPress cannot access the database. To verify the database details, you can view the contents of the file wp-config.php. To find this, you will need to first locate your document root. After logging in to cPanel, select Domains under the Domains header in Tools (or use the search in the top-right). You will now see a list of your domains. 

You can click on the link under "Document Root" to see the files for your website. Now, click on "wp-config.php" then click “View” in the toolbar.

Finding database settings

Take note of the values for DB_NAME, DB_USER and $table_prefix  you can see in this file. The database settings should look something like this:

/** The name of the database for WordPress */

define( 'DB_NAME', 'example_wp_wysaj' );

/** Database username */

define( 'DB_USER', 'example_wp_xazve' );

/** Database password */

define( 'DB_PASSWORD', 'a8F7D!gw8*CGg&~V' );

/** Database hostname */

define( 'DB_HOST', 'localhost:3306' );

You can check that the database name and user match an existing database and user from “Manage My Databases”. cPanel Tools

Look under “Current Databases” to see the Database and linked users with privileges on this database:

"Manage My Databases" Module

You will also see a “Current Users” section that lists the database users. Make sure that the user has permissions over the table. You can add a user to the database using the drop-down menus.

Add a User

To check the table prefix, click on “phpMyAdmin” from cPanel, then click on the database name that matches what you found in “Manage My Databases”. You will see the names of the tables appear. In the below screenshot, “7bgVA4qBG_” is the table prefix.

PhpMyAdmin

If this looks different to what is in the "wp-config.php" file from earlier, you will need to update this file from the File Manager to remedy this.

3. Review your .htaccess 

Some .htaccess modifications by plugins can break your site. You can find the ".htaccess" file the same way we found "wp-config.php". Take a copy of your existing .htaccess , then try replacing it with the following WordPress default contents by clicking on the file and then “Edit” in the File Manager toolbar: 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 

4. WordPress error logging 

By enabling error logs, you will be able to see what errors are being reported by WordPress. This information can help you determine what the issue is and can be useful for developers when fixing your site. Take a backup of your existing wp-config.php file (as located in the File Manager in the previous step) before adding the following lines to the file (click “Edit” in the toolbar after clicking on the file): 

define( 'WP_DEBUG', true ); 

define( 'WP_DEBUG_LOG', true ); 

define( 'WP_DEBUG_DISPLAY', false ); 

Now, load the site and view the error logs under wp-content/debug.log for further analysis. Ensure to revert the changes once the error has been captured to avoid runaway storage growth. 

You might also find useful information in the PHP error logs: https://support.cpanel.net/hc/en-us/articles/4414072152471-Where-are-the-PHP-error-logs-located

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I do a traceroute/tracert?

By doing a traceroute or tracert, you can help us diagnose common connectivity issues, and where...

How do I flush my DNS cache?

Please follow the instructions accordingly: WINDOWS:- Start -> Run -> type cmd- in command...

Submitting your website to Google

Google has a lot of useful resources. For developers, start with their SEO Fundamentals...

How do I clear my shopping cart?

To clear your cart: Click "view cart" on the top right hand corner of your dashboard  Click...

Maxmind error when placing an order

Our fraud detection system (Maxmind) may at times falsely mark your order as fraud.In such cases,...