robk27
robk27

Reputation: 693

CakePHP 2.1 new install Missing Controller Error

I am completely new to CakePHP and installed 2.1. I am getting this error:

Missing Controller

Error: Index.phpController could not be found.

Error: Create the class Index.phpController below in file: app\Controller\Index.phpController.php

<?php class Index.phpController extends AppController {

} Notice: If you want to customize this error message, create app\View\Errors\missing_controller.ctp

Stack Trace

APP\webroot\index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse) ROOT\index.php line 40 → require(string)

I followed their guide at http://book.cakephp.org/2.0/en/installation/advanced-installation.html and tried everything it stated:

I do not know where to proceed from here. Thanks for any help you can give me.

Upvotes: 1

Views: 9568

Answers (3)

Rohit Choudhary
Rohit Choudhary

Reputation: 2269

If you are using cakephp 2.0 or greater than rename the controller file name as the class name. ie TaskController.php

class TasksController extends AppController {

--Your code inside class
}

I hope this will help you

Upvotes: 1

Farray
Farray

Reputation: 8528

Update: I just re-read your question and realized you're loading http://localhost/cakephp/index.php. Don't do that. Since you appended "index.php", it is trying to load a controller called "index.php" and the action "index" for that controller. Resulting mapped path to the "index.php controller" is app\Controller\Index.phpController.php.

Since you have the rewrites enabled, browse to http://localhost/cakephp without appending any filename.


Original answer:

Assuming you're using Apache, double-check the .htaccess in your /app/webroot directory. It should include the following:

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

Based on your error, it doesn't look like it's properly appending the path after your index.php file.

Upvotes: 4

mark
mark

Reputation: 21743

the easiest solution is to stick to the "live environment" as close as possible. this means using vhosts to use a "domain" and correctly root down to your webroot dir: http://www.dereuromark.de/2011/05/29/working-with-domains-locally/

this leaves almost no room for error and also helps with other potential problems like "absolutely linked asset files" etc

Upvotes: 0

Related Questions