简体   繁体   中英

Gii doesn't load in custom build of Yii2

I'm using the Foundationize custom build of Yii2, which is a couple of years old but in general seems to run just fine.

However, when I've come to run the gii tool for generating new models etc. the routing is ignored and my application's index page is simply reloaded.

The URL I'm trying to access is http://localhost/web/index.php?r=gii

I have this line in my index.php

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

and my config/web.php contains the following

if (YII_ENV_DEV) {
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    'allowedIPs' => [$_SERVER['REMOTE_ADDR']], // always allow on current server
];}

Am i missing a step somewhere? I tried the 'basic' setup from the main Yii site and that seemed to work fine on the same server. Thanks in advance.

For some reason it was the routing that was broken in this install

instead of

http://localhost/web/index.php?r=gii

I used

http://locahost/web/index.php/gii

and it was all fine

I think you modified your configure ( in config/web.php )

'components' => [
       'urlManager' => [
          'class' => 'yii\web\UrlManager', //clase UrlManager
          'showScriptName' => true,  // to remove index.php
          'enablePrettyUrl' => true  //for Friendly url
        ],
 ],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM