DEBUG Mode For Live

Just a note.

When you deploy 2.0 to remote server. You need to set

defined('YII_DEBUG') or define('YII_DEBUG', true);

defined('YII_ENV') or define('YII_ENV', 'dev');

But the code only allows local host Go to your app config page and add

the below line

if (!YII_ENV_TEST) {

    // configuration adjustments for 'dev' environment

    $config['bootstrap'][] = 'debug';

    $config['modules']['debug'] = [

        'class' => 'yii\debug\Module',

		'allowedIPs'=> ['*']      <--------- or your IP for security


    $config['bootstrap'][] = 'gii';

    $config['modules']['gii'] = [

        'class' => 'yii\gii\Module',



Note that in general it’s a very bad idea to enable debug and development mode at production server.

1 Like

It is much better to use Docker/VirtualBox/Vagrant to replicate the remote server, if it is impossible to replicate the environment on your own machine.

Debugging a live server is not very smart, to put it mildly. :)

Sorry to raise an old post, but I’m looking for information and I can’t find it.

Because it may be that some extensions stop working when we go from development to production environment and when we set debug mode false.

I hope some answer that helps me, thank you very much!

Need details.

I have already understood what happened to me when a project went into production. Some assets that developers write validate if it is in debug mode or not to modify which resource should be published, in my case I had a widget that needs to be modified. This is the case .

You must realize that I have not said anything.

Greetings and thanks for your answer!