Debug settings

Skip to first unread message

Mike Little

Jun 15, 2011, 8:12:40 PM6/15/11
to Manchester WordPress User Group (MWUG)
I mentioned in this evening meeting about good debug settings for WordPress.

You may see a few resources that will tell you to add the WP_DEBUG setting to you wp-config.php page. But by itself that can be quite harmful as in many server configurations, your site will start showing PHP error and warning messages *on you site pages*. It will also log these errors to Apache's error log, which is not always the best place for them to go.

Here are the settings I use.
define('WP_DEBUG', true); // false
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

These few lines go into your wp-config.php and, as always with additions to this file, you should put them just above the line that says /* That's all, stop editing! Happy blogging. */

The next thing you will probably need to do is create a file called debug.log in you wp-content directory. Depending on your permissions, WordPress may be able to create it itself. If it cannot create the file yourself locally, you can add a line of text to it if your software has issues creating empty files, then upload it to your wp-content directory.

Next make sure the permissions on this file are correct. If it got created for you they will probably be correct, though you may have trouble deleting it via ftp. but if you manually created it, then you will probably want to set the permissions to 666 (not 666 is for files, 777 is for folders -- but only when you want any and everyone to be able to write to or  delere that file/folder.

Once you have done this, you should see the size of the file growing as you use your site. At any point you can download it to get a good look at it. With luck a clue to the problem you are having will be found in there. Most messages will tell you what the error or warning is, and list the file and line where the problem occurred.

Remember to turn debugging off when you have finished your investigation.

There are some further debug flags to help debugging JavaScript and CSS. See

Hope this helps,

Mike Little

Philip Norton

Jun 16, 2011, 4:02:57 AM6/16/11
Thanks Mike, that's really useful information! I see you are also mentioned by name on the wp-config page you sent over :)


See the group blog at
You received this message because you are subscribed to the Google
Groups "Manchester WordPress User Group" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Azizur Rahman

Jun 16, 2011, 10:26:12 AM6/16/11
The code presented here is ideal because it only create/update the log file when you have debug turned on, Where as the code on the codex page keeps writing to log regardless.
Reply all
Reply to author
0 new messages