0
votes

I uploaded YII2 advanced my web app to online server.

I have 2 tables(companies,employees) and generated CRUD for these 2 tables.In main menu navigation given to view of company. the below code i given on backend/views/layouts/main.php for navigation.

 $menuItems = [
                 ['label' => 'HOME', 'url' => ['/site/index']],
                 ['label' => 'COMPANIES', 'url' => ['/companies/index']]  
                 ['label' => 'EMPLOYEES', 'url' => ['/employee/index']],

           ]; 

It's worked properly on localhost. But in online getting this exception.

Invalid Parameter – yii\base\InvalidParamException The view file does not exist: /home/echosoft/public_html/echosoftware/backend/views/companies/index.php

The file is existing in that folder.Please help me to solve this issue. I am stuck with this for 3 days.

This is backend\config.php codes

$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);


return [


    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],




    ],
    'params' => $params,

];

This may help.Thanks in advance.

1

1 Answers

0
votes

try using

      ['label' => 'COMPANIES', 'url' => ['/companies/index']]  

and if the localhost is windows and online server is unix/linux like be sure you have the proper case in the pathname filename Windows in case insensitive in pathname unix is case sensitive

If in your backend\views you have the folder name with uppercase (backend\views\Companies) you should change with lower case (backend\views\companies) ..