September 2, 2008

CodeIgniter: No Output

Filed under: CodeIgniter (CI) — Soleer @ 10:27 pm

The Problem 

We experienced a problem when attempting to move one of our codeigniter (CI) websites from one server to another.  We performed the transfer of the files, database setup, and necessary config file changes.  Then came time to test, and… Nothing.  FireFox and IE7 both rendered a blank page.

Debugging 

We tracked down the problem, by setting up test points within the php code.  Basically we’d put a ‘print “test” ‘ command in various places, and if it was successfully displayed, then the code was breaking after that point.

Starting with the index.php file, the breaking points were as follows:

<base_path>/index.php (approx. line 117)
require_once BASEPATH.’codeigniter/CodeIgniter’.EXT;

<base_path>/system/codeigniter/CodeIgniter.php (approx. line 80)
$EXT =& load_class(’Hooks’);

<base_path>/system/libraries/Hooks.php (approx. line 43)
log_message(’debug’, “Hooks Class Initialized”);

Okay, so the “log_message” was causing the problem.  After searching the CI user guide, we found the Error Handling page.  At the bottom, it states:

Note: In order for the log file to actually be written, the “logs” folder must be writable. In addition, you must set the “threshold” for logging. You might, for example, only want error messages to be logged, and not the other two types. If you set it to zero logging will be disabled.

So, possibly this was a permissions issue on the logs folder. 

The Solution 

To solve the problem, we navigated to our server, and changed the permissions to 777 (read/write/execute across the board) for the logs folder (<base_path>/system/logs).  

[localhost]$ chmod 777 system/logs

We did this via ssh, but you could also use some other file manager or possibly ftp on some servers. 

…And voila!  Our site threw us a database error. 

We had never been so happy about a database error before!  With the problem isolated, we quickly solved the issue, and got the website rolling.

Who we are

Explore our history and character.

If you've ever been on a blind-date, odds are great that you know how disastrous "jumping before looking" can be. Feel free to do some online stalking here before you contact Soleer.

What We Do

"Girls only want boyfriends who have great skills." -Napoleon Dynamite

While we aren't looking to be your boyfriend and might not have "nunchuku skills," we do offer a number of other services and solutions to assist your organization.

What We’ve Done

As we say in Texas, "This ain't our first rodeo." Take a look at a sampling of some of our masterpieces, from logo design and brochure creation to webpage design and online community development.