1
votes

I have a Cake 2.3.8 app that works fine on localhost and I uploaded it to an Ubuntu 12.04 EC2 instance, but on the index/home file I'm getting a "Missing Controller" error.

The CSS, header and footer load fine on the home/index page, but it can't seem to find the controller. Every single other page/controller of my app won't even load, I get a 404 error.

I tried this but my issue still persists.

What else should I look for that would cause it to not find the controller and not even load any other pages?

Update

I moved my contents to /var/www so it would be accessed through my-ec2-instance.com. When I go to my-ec2-instance.com/index.php the page displays (which is PagesController/home.ctp). However, anything else gives a 404 error. Modrewrite is also enabled

I can also access my actions when I reference index.php, although it displays in mobile format for whatever reason (I have a responsive template). Ex: www.my-ec2-instance.com/index.php/users/login works, although it's in a mobile format

www.my-ec2-instance.com/index.php  //works

www.my-ec2-instance.com/index.php/users/login  //works, but mobile format

www.my-ec2-instance.com/users/login  //404 error
2
can you add the exact error message here? - Guillermo Mansilla
@GuillemoMansilla It says "Missing Controller Error: Project1Controller could not be found.". This is on the index page, which would be the PagesController. - user1443519
what is the url you are using? - Guillermo Mansilla
@GuillemoMansilla I'm accessing exactly as if I would on localhost. my-ec2-url.com/Project1 - user1443519
@GuillemoMansilla My app is located in /var/www/Project1 not /var/www. When I visit that it just shows the apache "It Works" message. - user1443519

2 Answers

1
votes

Please connect your instance via putty then press

sudo nano /etc/httpd/conf/httpd.conf

Check the given below line and remove the # tag

LoadModule rewrite_module modules/mod_rewrite.so

After that you can replace:

AllowOverride None

with

AllowOverride All

Note: AllowOverride None -> AllowOverride All.

From Crtl+X then press Y then press Enter (you can use this command according to your OS)

After that you can execute the command in putty

sudo service httpd restart

Then check your .htaccess file (please make sure your .htaccess should be correct) for cakePHP .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
0
votes

Sounds like an issue with your .htaccess file which is what would properly rewrite short URLs & handling controller routing.