Debugging Cake PHP Applications

A common question new starters to CakePHP ask is regarding debugging. Many users start off with basic scaffolding and confronted with the uninformative error ....

Not Found

The requested URL /index.php was not found on this server.

This is because your CakePHP application is set to production mode. In production mode you would not want your visitors and clients seeing detailed error reports, it would worry them.

To find out what the actual problem is open up file app/config/core.php and find line 45(ish) and you will see the following ....


Configure::write('debug', 0);

Change the above value from 0 to either 1, 2 or 3 and you will get a much more helpful error message. We recommend you set it to 2.

Direct from the CakePHP comments itself; here is an explanation of each debug level...

* Development Mode:
* 1: Errors and warnings shown, model caches refreshed, flash messages halted.
* 2: As in 1, but also with full debug messages and SQL output.
* 3: As in 2, but also with full controller dump.

It is worth noting that when debug level is set to anything other than production mode (0), any 'flash' messages and redirects you have will not redirect automatically, you must click the link to forward on.

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)