Panel Error when debug = false

As long as I set the parameter debug to true:

c::set('debug',true);

Everything works fine. Website and Panel.

But when I try to deactivate debug mode, something goes wrong:

c::set('debug',false);

The website still works. But when I try to login onto the Panel, I get immediately following error:

The field class is missing for: index.htmlfield

I’ve installed:

Toolkit Version: 2.4.1
Kirby Version: 2.4.1
Panel Version: 2.4.1

I tried to deactivate all plugins, but the error still appears.

If your server is correctly configured, you would not have to set debug to false. Rather, set debug to true in a special localhost config file. If you follow these suggestions that, does the panel work?

There’s also a similar problem described here, where the error was caused by an empty folder in /site/fields or the plugins folder.

Sorry, but I’m a little bit irritated.

Please make sure though to switch this off in production! Displaying PHP errors on a public server can be a security issue
Debugging

An you suggest to leave the debug-mode in production environment active? Sure?

OK, while developing in a local configuration, I use debug = true. For the production environment I should use debug = false. But then the Panel won’t work anymore.

What’s the solution of this problem?! I think, there must be a problem in the Panel-scripts. But I’m not able to identify this problem, when it only occurs when debug-mode is false.

No, of course not, but usually, the debug settings should be done in your php.ini. In a well configured environment, you would set debug to true in your php.ini, but display errors off (so that errors are logged to a log file, but not displayed on-screen).

If this is configured as it should be, and you only set debug to true in a config.php file for your localhost, then it is not necessary to set debug to false on the production environment.

Sorry, but I still don’t get your point.

On my production environment the php-debug mode is by default off. When I leave kirby’s debug active (true), as you suggest, then a user of my website sees every error including source code, altough php-debug-mode is off. So I have to disable kirby’s debug mode to hide internals when something goes wrong.

And when kirby’s debug mode is false, the panel won’t work anymore.

That’s why I suggested you use a config.php file for localhost (config.localhost.php) with debug set to true (not in the general config.php), which will then be ignored on your production server. Then you don’t have to set debug to false on the production server.

  • config.php: no debug setting at all
  • config.localhost.php: debug true

On the production server, make sure that your php.ini settings are set as described above, with debugging enabled, but on-screen errors off.

1 Like

OK, I checked it. I would never have had the idea, that kirby’s panel differentiate between debug = false and debug = null/not defined.

It wouldn’t be so irritating when the documentation of the debug-option would be in sync with this definition.

And nevertheless the Panel has still an issue with this setting. To avoid setting the debug-mode is only a workaround. Because when I read a configuration file, especially different ones for multiple domains, it is good to see, that someone intended to disable debug-mode.

Well, yes, it is a workaround for the moment, we probably need to look into why this happens.

But then again, setting the debug settings via the config.php is a quite brutal way of overwriting server settings, anyway. It is only there to make stuff easy for users. The correct way would be via the php.ini.

Edit; I’d still like to know if the reason for this is the same as described in this issue: Panel login - Too many redirects