Aishwar
Aishwar

Reputation: 9724

CakePHP Missing Controller - but it exists

I recently downloaded cakephp-1.3.4. I set it up on my web server. I followed the advanced installation settings. My folder structure is as follows.

/common/
  cakephp/
     app/
     etc...
/htdoc/

The /htdoc folder is the webroot; cakephp resides in the common folder.

I have configured the paths in index.php to point to this folder structure. I have the app up and running. I created a layout, the app has picked it up (along with all the css and images - all that works).

I created a posts_controller.php in cakephp/app/controllers/. Now when I try to access the following page: http://localhost/posts. I get a message that the controller cannot be found and that I should create a app/controllers/posts_controller.php (it already exists!).

Also the strange thing is using the default pages_controller works. I created an about.ctp and dropped it in app/views/pages/about.ctp. Vising http://localhost/pages/about shows up as expected.

SOLUTION:

Sam helped me solve this problem (see the long comment thread below). The problem was I had set relative paths for my ROOT folder. This messed things up. The solution is to either directly set an absolute path or call realpath with your relative path for it to be resolved into the right absolute path.

Upvotes: 1

Views: 11057

Answers (1)

Sam Day
Sam Day

Reputation: 1719

Make sure your controller class is named correctly (should be PostsController) and inherits from AppController (not strictly necessary but good practice).

Upvotes: 3

Related Questions