1
votes

I have a cakephp project under folder FC such that on ubuntu, it's path is /var/www/FC/app/... Upon uploading to ec2 and making all configuration changes, the base path, ie. index.php is correctly opening but any other link on index.php is giving an error:

Error: FCController could not be found.

Error: Create the class FCController below in file: app/Controller/FCController.php

class FCController extends AppController {

}

Upon creating this file, it asks to put method locations into the class FCcontroller, and on putting an empty method in the class, the display goes blue like an empty page. Since I haven't written this code I have no clue where the data which should be here is written...what should I Do?

2
can you please update controller code with the method you wrote....and for that blue screen look into views folder you will see layout.ctp file...that is the file which is main template file. - Dipesh Parmar
There's no method in FCcontroller, in fact there is no FCcontroller in my code. I just made an empty method as the error was showing me to do to check what happens...I think default path to controller is set incorrectly, how do I change path to controller, where is it given in configuration? - Anugrah
you can see it at Config folder...and inside that folder you will see route.php file... - Dipesh Parmar
Ok, so in routes.php, these are the two routes shown: Router::connect('/', array('controller' => 'locations', 'action' => 'index')); Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); So locations is my main controller which goes to action index. Is the second command incorrect? Because pages is the default example given by cake, I checked. What happens on using the second command? - Anugrah
Sounds like just an issue with the paths needing altered in the webroot/index - Dave

2 Answers

1
votes

You need to alter these three lines in your app\webroot\index.php:

// The full path to the directory which holds "app", WITHOUT a trailing DS.
define('ROOT', '/var/www/FC');

// The actual directory name for the "app".
define('APP_DIR', 'app');

// The absolute path to the "cake" directory, WITHOUT a trailing DS.
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');

to point to their respective locations.

(the last of the three is commented by default, so you'll need to uncomment it.

1
votes

i sorted the issue out. It was because in my code, the previous user had made a controller file Locationscontroller.php and specified urls like this:

<form id ="0" action="/FC/locations/confirm_final">

This was for localhost in my local machine where the base folder was htdocs I had to type localhost/FC/ to access index.php. So naturally Since on EC2 I had made FC itself my base folder, it was trying to access another FC inside it which didn't exist. The /XXX/locations/ means it searches for "XXX" controller and then locations inside it. Since my controller was Locations, it kept giving an error.

As soon as I changed it to this:

<form id ="0" action="/locations/confirm_final">

It pointed to the right controller which was locations. It was all because I didn't check which controller was called by which View! I'm an idiot, that'll be all :D