Yii generates error "Unable to resolve the request <controller/action>"

yii
32,393

Solution 1

Make sure the filename of your controller is EXACTLY "MembersdetController.php". It is case sensitive.

I guess you were developing on local machine under Windows OS and server runs on *nix system. That's normal issue for novice developers, that they forget about case sensitive file system in *nix.

Solution 2

It is because of wrong controller file name given or may be actionIndex() method is not in your controller.

Solution 3

I have had a similar problem and got it solved. In this case the file was correctly named but the class name was wrongly spelled. When these two do not correspond, you could get this error too.

Solution 4

Check case sensitive exactly your controller: MembersdetController

Check alias (common in config/main.php) map with namespace in your controller

Yii::setAlias('@tienn2t', dirname(dirname(__DIR__)) . '/tienn2t');

In MembersdetController.php file

<?php
namespace tienn2t\controllers;

use Yii;
use yii\web\Controller;

class MembersdetController extends Controller{
    public function actionIndex(){
        echo 1;die;
    }
}
Share:
32,393
Harpreet Singh
Author by

Harpreet Singh

Updated on December 11, 2020

Comments

  • Harpreet Singh
    Harpreet Singh over 3 years

    After logged in successfully, Yii does not executing any page.

    Showing an error:

    Error 404 Unable to resolve the request "membersdet/index"

    Here membersdet is controller Id and index is an action.

  • Harpreet Singh
    Harpreet Singh about 12 years
    I have run this project successfully in localhost. but this creating problem in live server. I am getting error at this place - CWebApplication->runController('membersdet/index')
  • Gunnit
    Gunnit about 11 years
    is there a plugin in yii or a code that i can use so that i dont have to rename every single controller action and page ?
  • Kristjan O.
    Kristjan O. over 5 years
    Old answer, but it got me here ... Also note that you should not use CamelCase, so MyProfileController.php is wrong, while MyprofileController.php is correct.