M3Server Technical Blog WordPress Troubleshoot WordPress Errors

Troubleshoot WordPress Errors



Troubleshooting WordPress is easier than most php based applications since it has debug code built in. You just need to enable it. We will show you how, but please take the time and learn what your doing rather than following steps. We highly recommend developing on another VPS server to avoid causing problems with your live site. Always best to test first!

Do note, that while we go the extra mile to assist clients in anyway we can, we are not tech support for WordPress. WordPress.org has great forums filled with knowledgeable staff. So before you make WordPress your platform of choice to build your web site or enterprise, do study it’s operation and know how to contact the forums and 3rd party plugin publishers for support. If the 3rd party plugin publisher is no loner answering support, script is outdated for years, why use it and risk your site’s operation?

https://wordpress.org/support/

First, read the manual here:
Debug WordPress

Opening the file wp-config.php with your favorite plain text editor reveals the manual:


* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information by
* visiting {@link https://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.

Second, make a backup of your current file please. Save your self time and money if something goes wrong.

WARNING. Improper use or simple typo of a file edit can render your site broken / inoperable. Don’t scream at your neighbor if you forget to make a backup of your file. Then, if things go wrong, you can just upload your original file to the server via ftp. Backups are important, you have been politely warned.

Using information from the manual above, we like these settings for our blog:


/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content (if Apache does not have write permission, you may need to create
 * the file first and set the appropriate permissions (i.e. use 666 or 777) )
 */
define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
define( 'CONCATENATE_SCRIPTS', false );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
/* That's all, stop editing! Happy blogging. */

You can experiment by enabling WP_DEBUG_DISPLAY by setting the value to true. This will allow errors to be displayed in your browser. display_errors will need set to 1 in the example above.

You will find the debug.log in your base WordPress path under the directory:
/wp-content/debug.log

Is is recommended that you block access to this file with this .htaccess modification:

Order allow,deny
Deny from all

Additionally, you can login to your M3Server control panel to also view traffic logs and error logs. Access is also provided by ssh/ftp download of the files in your user’s home directory:
/home/user/logs/site.com.error.log
/home/user/logs/site.com.log

These are enabled by default on all M3 6 series servers using M3Admin version 6 control panel.

Leave a Reply