Daniel Castro
Daniel Castro

Reputation: 633

Missing Controller Error on remote server using Beta 3

I've been working on a project on my local machine (running OS X with Cake server) using CakePHP 3 Beta. Sometimes I copy this project to a remove test server (running Ubuntu with Apache).

Last time I copied all the files to the remote server, Beta 2 was the newest version, and the site was running just fine on both machines.

When Beta 3 came out, I updated my local project and continued working on it on the local machine without running into any issues.

Today I copied the whole project to the test server, just as it is on my machine (adjusting database configurations, of course), but something weird is happening this time:

When I access URLs like http://www.example.com/controller/action I get a Missing Controller error, as can be seen in the screenshot below:

Error page example

I've been following the conventions as seen on the documentation, so my controller is the class UsersController inside the file UsersController.php

But if I access http://www.example.com/Users/action, for example, it just works. Keep in mind that the exact same files work on my local machine using lowercase URLs, so it isn't just some typo or misplaced file.
This happens for all my controllers.

Should I now follow the naming conventions the error page suggests me and user lower case first letters on all my controllers?
Is this a bug or am I doing something wrong?

If you need any other information, feel free to ask.

Thanks for helping me out!
Best regards,
Daniel

Upvotes: 0

Views: 294

Answers (1)

ndm
ndm

Reputation: 60503

You are missing appropriate inflecting routes that would turn users into Users in order to match the filename UsersController.php, this is evident from looking at the error message which says usersContoller is missing.

It works on your local machine as the default OS X filesystem is by default case-insensitive, unlike the one in Ubuntu, which is case-sensitive.

In case you have updated the core lately the RouteBuilder::fallback() call that is present in the app routes by default may be missing the InflectedRoute argument, which wasn't necessary before.

https://github.com/cakephp/cakephp/commit/5af6464a49204f873aeac52024d295787809822a#diff-37dbf1f85d9888de3ac3c50006f2704f

So, check your routes, and update your app template if necessary.

https://github.com/cakephp/app/commit/4719b42f9db0d80b3dd22edc6a4476566dbb0215

Upvotes: 2

Related Questions