Reputation: 16817
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
Upvotes: 0
Views: 1236
Reputation: 30766
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.
Upvotes: 1