How to Enable PHP Error Log for a WordPress website?

Wordpress is widely used open-source CMS and it is coded in PHP and MySQL. Wordpress provides a few debug options which will help you to find the error logs. Once you find the error logs for Wordpress Website, it will be very useful to fix your issues. Following are the tips to enable the PHP error log.

 

Enable Debug from Wp-Config File

You can enable Wordpress error from the wp-config.php file. By Default error log will be disabled, you will need to make some configuration changes to enable the Debug. Wordpress uses PHP Constant to enable the debug. You can edit the wp-config.php file and do the below changes it will impact on the entire Wordpress to enable error log.

 

define( ‘WP_DEBUG’, true );

Once you enable the Wordpress error log, all PHP errors, notices, and warnings will be displayed on your website. You can enter the below line inside your wp-config.php file. It will store the error in the debug.log file located inside the wp-content.

 

define( ‘WP_DEBUG_LOG’, true );

WP_DEBG_DISPLAY will prevent the errors to appear on the website. By default this option will be set to True, we will need to make changes to disable it.

 

define( ‘WP_DEBUG_DISPLAY’, false );

We recommend you to make the following changes in your WordPress .htaccess file to restrict the access of debug.php publically. You can also set 600 permission to the debug.php file. Once you do this, debug.php will not be accessible on the web. However, you can access the file within your Wordpress.


<Files debug.log>
Order allow,deny
Deny from all
<Files/>

 

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to make a WordPress Website Search Engine Friendly?

You can make your WordPress blog SEO-friendly by configuring the URL structure with permalinks....

How to Migrate / Transfer WordPress Website from WordPress.com to AccuWeb Hosting?

To transfer your WordPress.com website to a self-hosted WordPress website, first you will need a...

How to install Woocommerce on your Wordpress?

If you have installed the Wordpress and want to run an online store, we highly recommend you to...

How to change the WordPress dashboard language?

When you install the WordPress default language will be English. You can change it from the admin...

Fix-Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Usually, this error does occur when you are using an incompatible PHP version with your current...