Yii2 shows
SQLSTATE[HY000] [2002] A socket operation was attempted to an unreachable host.
when there is no internet access, how can I make it redirect to a page, says ./index.php?r=site/neterror? I tried to do this in web/index.php by using this code
<?php
use yii\db\Exception;
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
try
{
(new yii\web\Application($config))->run();
}
catch(Exception $e) {
header("Location: ./index.php?r=site/error"); /* Redirect browser */
exit();
}
but all I get back is The page isn't redirecting properly.
YII_DEBUGenvironment to 'false'