File: index.php
switch ($domain) {
case "localhost":
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
#... (hidden code)
$config = require(__DIR__ . '/../config/local/localhost.php');
break;
case "code.huypv.net":
case "www.code.huypv.net":
if(isset($_GET['dev___x___bug'])) {
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
} else {
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
}
#... (hidden code)
$config = require(__DIR__ . '/../config/server/serverlive.php');
break;
}
On localhost, we see Yii2 debug panel. But on real server, we don't see debug panel. Check log, we have message: Unable to resolve the request "debug/default/toolbar". What happened?
Solution: Change code in index.php
switch ($domain) {
case "localhost":
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
#... (hidden code)
$config = require(__DIR__ . '/../config/local/localhost.php');
break;
case "code.huypv.net":
case "www.code.huypv.net":
if(isset($_GET['dev___x___bug']) || isset($_COOKIE['ck_dev___x___bug'])) {
if (!isset($_COOKIE['ck_dev___x___bug'])) {
setcookie('ck_dev___x___bug', 'ready', time() + 7*24*3600, '/');
}
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
} else {
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
}
#... (hidden code)
$config = require(__DIR__ . '/../config/server/serverlive.php');
break;
}