Jump to content

Tip (you likely knew already) about the setting $config->debug = true;


alan
 Share

Recommended Posts

In case you didn't know or had forgotten, in PW you can edit 

/site/config.php

and set 

$config->debug = true;

to help track down errors. I've often found 'soft errors' (bad practice PHP etc (something you get if you are PHP 'lite' like I am)) that were previously hidden are displayed when this is set to true.

But I also found I set it and forget that it's set then sometimes see a page load slightly slowly or with a visible 'flash' and wonder what's wrong, only later remembering I have debug left on. So now as a reminder I echo (if the setting is true) a reminder somewhere obvious such as adjacent to the homepage (or every pages's) H1. It's good to be reminded since going to a production site with it set to true is NOT recommended (API doc). This is the simple test and echo I now add:

if(wire('config')->debug) echo "<span class='alert'>Flashy? Slow? Probably because of \$config->debug = true;</span>";
  • Like 6
Link to comment
Share on other sites

Welcome diogo.

I was inspired when turning it on showed me bad PHP I'd written but then forgetting it was on I'd see slightly slow page loads and think "Eek! what poor performance code have I done?" (forgetting it was still turned on).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...