使用Beta 3的远程服务器上缺少控制器错误 [英] Missing Controller Error on remote server using Beta 3

查看:74
本文介绍了使用Beta 3的远程服务器上缺少控制器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用CakePHP 3 Beta在本地计算机上运行一个项目(运行带有Cake服务器的OS X)。有时我将此项目复制到可删除的测试服务器(使用Apache运行Ubuntu)。



上次我将所有文件复制到远程服务器时,Beta 2是最新版本,并且该站点在两台计算机上都运行良好。



当Beta 3发布时,我更新了本地项目,并继续在本地计算机上进行工作,而没有遇到



今天,我将整个项目复制到了测试服务器上,就像它在我的机器上一样(当然,正在调整数据库配置),但是发生了一些奇怪的事情。这次:



当我访问,所以我的控制器是文件UsersController.php中的UsersController类。

但是,如果我访问 http://www.example.com/Users/action,例如,它可以正常工作。
请记住,完全相同的文件在我的本地计算机上使用小写URL即可工作,因此它不仅仅是错别字或放错了位置的文件。

这对于我所有的控制器都是如此。



我现在应该遵循命名约定,错误页面上建议我和所有控制器上的用户使用小写的首字母吗?

这是错误还是我在做有什么问题吗?



如果您需要任何其他信息,请随时提问。



感谢您的帮助!

最好的问候,

丹尼尔

解决方案

您缺少适当的屈折路线会将 users 转换为 Users 以匹配文件名 UsersController.php ,这可以通过查看错误消息来清楚地看到,该错误消息指出 usersContoller 丢失。



默认情况下,本地计算机上的OS X默认文件系统不区分大小写,而Ubuntu中的默认文件系统不区分大小写



如果您最近更新了核心,则 RouteBuilder :: fallback()调用默认情况下,应用程序路由中出现的值可能会丢失 InflectedRoute 参数,该参数以前是不需要的。



https://github.com/cakephp/cakephp/commit/5af6464a49204f873ac520822 -37dbf1f85d9888de3ac3c50006f2704f



因此,请检查您的路线,并在必要时更新应用模板。



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


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:

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

解决方案

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

这篇关于使用Beta 3的远程服务器上缺少控制器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆