Skip to content

Kirby 3.5.7.1

Debugging

Debug mode

Kirby honours your PHP error logging settings by default. If you've switched off error logging, you won't get any errors and might end up with a white screen.

Especially on your local machine, we recommend to switch on error logging in your php.ini. Kirby also has a built-in option which tries to enforce this:

/site/config/config.php
return [
    'debug' => true
];

Add this to /site/config/config.php in order to show errors immediately.

Make sure to disable debug mode in production! Displaying PHP errors on a public server can be a serious security risk:

  • Error messages are displayed with detailed information about the code structure (e.g. file path, class, method)
  • With Whoops enabled, there will be even more detailed information about the code structure
  • Detailed error messages for login failures could leak information to attackers

In a production environment, always log errors to your PHP error logs.

Screencast

Debug mode

Kirby's debug mode is super helpful for finding mistakes in your templates, snippets or other parts of your project.

var_dump

If you need to inspect one of Kirby's objects, such as $site, $page or any $file, we recommend to use var_dump:

var_dump($page);

It's a bit like PHP's equivalent of console.log() in JavaScript.

The output of var_dump() will be massively improved if you have Xdebug installed on your machine. Xdebug is most likely pre-installed if you use MAMP.

Bugs

If you run into an issue that you can't fix yourself and which seems like a Kirby bug, please post it on the forum in the issues category. We will take it from there and either try to help you out or move it to our official issue tracker on GitHub if it really turns out to be a bug.