Zend Framework 自动加载在部署时不起作用
我的基于 Zend 的网站在我的本地主机上完美运行(使用 Mac)。但是当我将其部署在 Linux 网络托管公司上时,出现以下错误:
在索引页面上尝试通过调用资源来列出我的广告,其中选择的是:
致命错误:在 /www/ 中找不到类“Lintotar_Model_Resources_Ad” webvol8/4v/7e33wem4920cqpg/lintottar.se/library/My/Model/Abstract.php 第 79
行在另一个页面上,视图助手似乎正在运行 - 主布局已渲染,但出现以下错误: 致命错误:第 16 行 /www/webvol8/4v/7e33wem4920cqpg/lintottar.se/application/modules/lintottar/views/helpers/SearchForm.php 中未找到类“Lintottar_Form_Search_Simple”
这是我的应用程序 ini:
自动加载有问题吗?我能做什么?我不明白出了什么问题,因为它可以在我的本地计算机上运行。
感谢您的帮助!
KR
约瑟夫
My Zend based website works perfectly on my localhost (using Mac). But When I deploy it on a linux web hosting company, I get the following errors:
On the index page which try to list my ads by calling a resource where the select is:
Fatal error: Class 'Lintottar_Model_Resources_Ad' not found in /www/webvol8/4v/7e33wem4920cqpg/lintottar.se/library/My/Model/Abstract.php on line 79
On another page the view helper seems to be running - the main layout is rendered, but I get the following error:
Fatal error: Class 'Lintottar_Form_Search_Simple' not found in /www/webvol8/4v/7e33wem4920cqpg/lintottar.se/application/modules/lintottar/views/helpers/SearchForm.php on line 16
Here is my application ini:
Is there a problem with the auto loading? What could I do? I can't understand what's wrong since it works on my local computer.
Thank you for your help!
KR
Josef
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,在您显示目录结构后,我明白问题是什么了。问题是这些目录(例如
resources
和ad
和search
)应该是大写的(例如Resources
) 。它之所以能在 Mac 上运行,是因为尽管 OS X 是基于 UNIX 且区分大小写的,但如果找不到匹配的文件名,它会尝试不区分大小写。因此,基本上更改文件夹名称以反映实际的类名称,它应该可以工作。请注意,模块目录中的根文件夹,例如
models
、forms
、controllers
和views
仍应位于小写。模块资源自动加载器就是这样设置的。Ah I see what the problem is after you showed your directory structure. The problem is that those directories (like
resources
andad
andsearch
) should be uppercase (eg.Resources
). The reason why it works on your Mac is because although OS X is UNIX-based and case-sensitive, if it doesn't find a matching filename, it'll try it case-insensitive.So basically change your folder names to reflect the actual class names, and it should work. Do note that the root folders in the module directory such as
models
,forms
,controllers
andviews
should still be lower-case. The module resource autoloader is setup this way.