Answer the question
In order to leave comments, you need to log in
Why does not open gii. Error 403 and 404?
Hello, for what reason can gii not open?
I write in main.php config:
<?
$config = [
'id' => APP_NAME,
'basePath' => APP_PATH,
'controllerNamespace' => APP_NAME . '\controllers',
'sourceLanguage' => 'ru-RU',
'language' => 'ru-RU',
'aliases' =>
[
'@basePath' => BASE_PATH,
'@app' => APP_PATH,
'@' . APP_NAME => APP_PATH,
'@admin' => ADMIN_PATH,
'@webroot' => BASE_PATH . '/public_html',
'@web' => BASE_PATH . '/public_html',
'@runtime' => BASE_PATH . '/runtime',
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'modules' => [
'admin' => [
'class' => 'admin\AdminModule',
],
'languages' => [
'class' => 'common\modules\languages\Module',
//Языки используемые в приложении
'languages' => [
'Русский' => 'ru-RU',
'Узбекский' => 'uz-UZ',
],
'default_language' => 'ru-RU', //основной язык (по-умолчанию)
'show_default' => false, //true - показывать в URL основной язык, false - нет
],
'gridview' => [
'class' => '\kartik\grid\Module'
],
'gridviewKrajee' => [
'class' => '\kartik\grid\Module' ,
// другие настройки вашего модуля сетки
],
'gii' => 'yii\gii\Module',
'debug' => 'yii\debug\Module',
'allowedIPs' => ['111.111.111.111'],
],
'bootstrap' => [
'log',
'languages',
'admin',
],
'runtimePath' => BASE_PATH . '/runtime',
'vendorPath' => BASE_PATH . '/vendor',
'defaultRoute' => 'public',
'components' => [
'request' => [
'csrfParam' => '_csrf-' . APP_NAME,
'class' => 'common\components\Request',
],
'cache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => BASE_PATH . '/runtime/cache',
],
'errorHandler' => [
'errorAction' => 'public/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.mail.ru',
'username' => '',
'password' => '',
'port' => '465',
'encryption' => 'ssl',
],
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'assetManager' => [
'bundles' => [
'yii\web\JqueryAsset' => [
'js' => [YII_DEBUG ? 'jquery.js' : 'jquery.min.js'],
],
'yii\bootstrap\BootstrapAsset' => [
'css' => [YII_DEBUG ? 'css/bootstrap.css' : 'css/bootstrap.min.css'],
],
'yii\bootstrap\BootstrapPluginAsset' => [
'js' => [YII_DEBUG ? 'js/bootstrap.js' : 'js/bootstrap.min.js'],
],
],
'baseUrl' => '/assets',
'appendTimestamp' => true,
],
'urlManager' => [
'class' => 'common\components\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'languages' => 'languages/default/index', //для модуля мультиязычности
'admin/<controller:\w+>/<action:[\w-]+>/<id:\d+>' => 'admin/<controller>/<action>',
'admin/<module:\w+>/<controller:\w+>/<action:[\w+]+>/<id:\d+>' => 'admin/<module>/<controller>/<action>',
],
],
'user' => [
'identityClass' => 'admin\models\User',
'loginUrl' => ['user/login'],
'enableAutoLogin' => false,
'authTimeout' => 86400,
'identityCookie' => ['name' => '_identity-' . APP_NAME, 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login
'name' => APP_NAME,
],
'i18n' => [
'translations' => [
'admin' => [
'sourceLanguage' => 'ru-RU',
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@admin/messages',
],
'app' => [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'ru-RU',
'basePath' => '@app/messages'
],
],
],
'formatter' => [
'sizeFormatBase' => 1000,
'dateFormat' => 'dd.MM.yyyy',
'decimalSeparator' => ',',
'thousandSeparator' => ' ',
'currencyCode' => 'RUB',
],
'authManager' => [
'class' => 'yii\rbac\DbManager',
'assignmentTable' => 'admin_auth_assignment',
'itemChildTable' => 'admin_auth_item_child',
'itemTable' => 'admin_auth_item',
'ruleTable' => 'admin_auth_rule',
'defaultRoles' => [
'User',
],
],
],
];
if (YII_DEBUG) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['bootstrap'][] = 'gii';
$config['components']['db']['enableSchemaCache'] = false;
$config['components']['mailer']['useFileTransport'] = true;
}
return $config;
Answer the question
In order to leave comments, you need to log in
You need to write your IP where you have the config
'gii' => 'yii\gii\Module',
'debug' => 'yii\debug\Module',
'allowedIPs' => ['111.111.111.111'],
or put 'allowedIPs' => ['*'],
but it's not secure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question