+3 votes
3.1k views
in Programming by (190 points)

Installed cake php in my server in this root C:\localhost\cake I have the items_controller.php file. I am thinking for some reason the application does not know where the controller file is present. The complete error is :

Missing Controller Error: ItemsController could not be found. Error: Create the class ItemsController below in file: app\Controller\ItemsController.php

<?php
  class ItemsController extends AppController {

  }

I have .htacess and index.php files in respective folder Can someone please help.

3 Answers

+1 vote
by Expert (3.8k points)

Controller class names are plural, CamelCased, and end in Controller. So your controller name should be ItemsController.php not items_controller.php. See here for more info on Controllers.

class ItemsController extends AppController { 
    //class code here
}

you should create controler inside the app\Controller\ 

For more details about Controller here

+1 vote
by Expert (5.1k points)
which version you are using?

because it's a wrong syntax in cake 2.0
by (190 points)
thanks for your interest , i am using this Version 2.3.9 can you tell me correct syntax?
by Expert (5.1k points)
which server are u using to local host WAMP or XAMP
+2 votes
by Expert (5.1k points)

try this..if u using xampp

 

xampp/apache/conf/httpd.conf
 #LoadModule rewrite_module modules/mod_rewrite.so -> remove # from this.
 Restart Apache
by Expert (5.1k points)
what server are you using , xampp or wamp?
by
i am using xampp
by Expert (5.1k points)
edited by
Hope you have followed the above steps , can you paste your controller code here , so i can understand better.
As per cake2.0+ your file name must be camelCased and plural as well.And file must be inside the controllers directory.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated