CodeIgniter 模块化扩展在 CentOS 上损坏
我已经使用 CodeIgniter (1.7.2+) 多年了,并让它在 15 个以上的实时生产环境中运行(喜欢它)。最近,我和我的团队指定了一个非常复杂的系统,需要比标准 MVC 更复杂的东西,因此我们开始研究 CI 的 HMVC 模块化扩展 (2.0.3)。到目前为止,我们已经在本地系统的 XAMPP 和 MAMP 环境中启动了它,没有任何问题,它看起来正是我们所需要的。当我们尝试在 CentOS 中加载它时,问题就出现了。
采用与我们本地安装完全相同的 SVN 存储库并将其拉出到 CentOS 服务器(我已经尝试了两个单独的 CentOS 盒子),它只会抛出一个白屏 - 在日志中我收到 500 错误。我确信它是 HMVC 模块的内部组件,因为相同的 CentOS 安装正在运行基本 CI 安装,没有任何问题。
为了排除故障,我删除了加载数据库的自动加载条目,然后我在屏幕上得到以下输出:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$db
Filename: MX/Controller.php
Line Number: 58
我只在 CentOS 机器上得到这个,该文件的第 58 行不是很说明问题,并且 HTTPD 错误日志没有显示任何有用的东西都可以。有没有人遇到过这个问题,其他人可以重现吗?我从未见过任何超出基本 CI 要求的服务器依赖项,所以我不知所措。我们迫切需要在这个项目中使用 HMVC,但我无法将无法加载的东西推向市场。
为了进一步限制我们注入不良内容的可能性,我重新安装了 CI,重新加载了 HMVC 模块,并且没有触及任何其他内容......失败!完全相同的结果,在 CentOS 5.5 上运行时出现相同错误的本地计算机。
非常感谢任何帮助...
更新
意识到错误只是一个通知(尽管我讨厌这样做),我关闭了错误报告只是为了看看发生了什么。它立即返回到抛出 500 错误。我可以在index.php 中添加一个die() 语句并将输出输出到屏幕上——所以更麻烦的是我在CentOS 中得到了HMVC 模块的完全失败,而不仅仅是一个通知。我将尝试通过系统去 die() 并找到正在执行此操作的实际行.... Joy..
按照 Craig A Rodway 的要求提供 4 级 CI 日志文件
DEBUG - 2011-09-06 20:49:37 --> Config Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Hooks Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Utf8 Class Initialized
DEBUG - 2011-09-06 20:49:37 --> UTF-8 Support Enabled
DEBUG - 2011-09-06 20:49:37 --> URI Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Router Class Initialized
DEBUG - 2011-09-06 20:49:37 --> No URI present. Default controller set.
DEBUG - 2011-09-06 20:49:37 --> Output Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Security Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Input Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Global POST and COOKIE data sanitized
DEBUG - 2011-09-06 20:49:37 --> Language Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Language Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Config Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Loader Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Controller Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Welcome MX_Controller Initialized
DEBUG - 2011-09-06 20:49:37 --> Loader Class Initialized
ERROR - 2011-09-06 20:49:37 --> Severity: Notice --> Undefined property: CI::$db /home/www/qualcentral.com/application/third_party/MX/Controller.php 58
更新#2
好吧,有两件事似乎导致了我的问题——我还没有完全修复,但我现在可以在系统中工作。首先,在 Windows 机器上解压 HMVC,提交到 SVN,然后下拉到 CentOS,这完全让我厌烦了。当我通过 WGET 将所有内容直接拉到 CentOS 并将其设置在服务器上时,它工作得很好!很奇怪,但至少这是一个解决方法——不需要对 PHP 或 Apache 进行调整,我认为在初始过程中出现了行结尾或某些东西被劫持。
其次,当我使用 HMVC 模块时,我无法使用核心系统自动加载器来加载数据库。我可以手动将其加载到三元组中,并且可以使用三元组的 config/autoload.php 文件自动加载,但如果我尝试的话,核心系统会抛出 500 错误。这是一个怪癖,而且让人恼火,但我可以解决它。
再次感谢大家的建议,这只是一个奇怪的事情。
谢恩
I have been using CodeIgniter (1.7.2+) for years now and have it running in 15+ live production environments (LOVE IT). Recently my team and I speced out a very complicated system that will require something a bit more complex than just standard MVC so we started looking into the HMVC Modular Extension for CI (2.0.3). Thus far we have fired it up in XAMPP and MAMP environments on our local systems with no problems at all and it looks like exactly what we need. The problem comes up when we try to load it in CentOS.
Taking the EXACT same SVN repo that works on our local installs and pulling it out to a CentOS server (I've tried two separate CentOS boxes) it just throws up a white screen--tailing the logs I am getting a 500 error. I am certain it is internal to the HMVC modules because this same CentOS install is running a base CI install without problems.
To troubleshoot I removed the autoload entry that loads the database and then I get the following output to the screen:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$db
Filename: MX/Controller.php
Line Number: 58
I only get this on the CentOS boxes, line 58 of that file isn't very telling and the HTTPD error logs aren't showing anything useful either. Has anyone ever had this issue, can anyone else reproduce it? I've never seen mention of any server dependencies outside of what base CI requires so I'm at a loss. We desperately need to use HMVC on this project but I can't go to market with something that I can't even get to load.
To further limit the possibility that we injected something bad I did a brand new install of CI, re-loaded the HMVC module and touched nothing else... FAIL! Exact same results, runs on locals broken with same error on CentOS 5.5.
ANY help is greatly appreciated...
UPDATE
Realizing that the error is only a notice (as much as I hate to do it) I turned error reporting off just to see what happened. It immediately goes back to just throwing a 500 error. I am able to put a die() statement in index.php and get output to the screen--so even more troubling is that I get complete abject failure of the HMVC module in CentOS, not just a notice. I'm going to trie to die() through the system and find the actual line that is doing it.... Joy..
Level 4 CI Log File as requested by Craig A Rodway
DEBUG - 2011-09-06 20:49:37 --> Config Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Hooks Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Utf8 Class Initialized
DEBUG - 2011-09-06 20:49:37 --> UTF-8 Support Enabled
DEBUG - 2011-09-06 20:49:37 --> URI Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Router Class Initialized
DEBUG - 2011-09-06 20:49:37 --> No URI present. Default controller set.
DEBUG - 2011-09-06 20:49:37 --> Output Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Security Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Input Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Global POST and COOKIE data sanitized
DEBUG - 2011-09-06 20:49:37 --> Language Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Language Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Config Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Loader Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Controller Class Initialized
DEBUG - 2011-09-06 20:49:37 --> Welcome MX_Controller Initialized
DEBUG - 2011-09-06 20:49:37 --> Loader Class Initialized
ERROR - 2011-09-06 20:49:37 --> Severity: Notice --> Undefined property: CI::$db /home/www/qualcentral.com/application/third_party/MX/Controller.php 58
Update #2
OK, two things that appear to have caused my issue--I am not completely fixed but I can work in the system now. First, unzipping HMVC on a windows machine, committing to an SVN, and pulling down to CentOS completely BORKED it. When I pulled everything down through WGET directly to CentOS and set it up on the server it worked just fine! Very strange, but at least it's a workaround--no adjustments to PHP or Apache needed, I figure a line ending or something got jacked during the initial process.
Second is that when I am using the HMVC module I CANNOT use the core system autoloader to load the database. I can manually load it inside a triad and I can autoload using a triad's config/autoload.php file, but the core system throws a 500 if I even try. It's a quirk and it's aggravating, but I can get around it.
Thanks again for everyone's suggestions, this was just an oddball.
Shane
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
未定义的属性:CI::$db
此错误表示您的数据库尚未加载。这看起来像你的 autoload.php 文件没有加载它,或者其他什么。可能是数据库正在加载到 MY_Controller 中,该控制器现已被替换。
另外,如果您使用的是最新的 HMVC,您可能会遇到困难,因为它正在开发用于 2.0.x 分支,而不是 1.7.x。这并不是说它不起作用,而是说它在每个发布的新版本中都不太可能起作用。
Undefined property: CI::$db
This error means your database has not been loaded. This seems like your autoload.php file is not loading it, or something. It could be that database was being loaded in a MY_Controller, which has now been replaced.
Also, if you are using the very latest HMVC you may well struggle as it is being developed to work with the 2.0.x branch, not 1.7.x. That's not to say it WONT work, but to say it is less likely with every new version that is released.