views:

362

answers:

8

Hi everyone,

After debugging a codeigniter app that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it have taken seriously way too long time.

PHP error_reporting(E_ALL) & display_errors", 1 is set as well. I even installed Xdebug in hope of getting more output, but no. My logging settings are also working, but nothing is written to the log.

Is there a way to get something informative printed out instead of a complete white screen? It would certainly shorten my time spent on solving the eventual errors that causes this?

Thanks a lot!

Reference: http://stackoverflow.com/questions/2149321/why-does-code-igniter-give-me-a-white-page

+7  A: 

If there's a fatal compilation error, then you may well get a blank page. Try doing a

php -l <filename.php>

against your script

Mark Baker
Thanks a lot for your help. I am not getting any output at all when running this :(
Industrial
You should get some output when you run a command line php -l, even if it's "No syntax errors detected in <filename.php>"
Mark Baker
+3  A: 

Look near the top of /index.php for a call to error_reporting() - and make sure it's not changing your php.ini configuration to something else (besides E_ALL).

And since you didn't mention your php.ini configuration, check to ensure you have error_reporting = E_ALL there as well.

Dolph
@Lucas Jones, thanks for the edit
Dolph
Hi! E_ALL is set in both index.php and php.ini
Industrial
Maybe a stretch, but is there anything at all when you View Source?
Dolph
Right now i am getting following <html><body><pre></pre></body></html>. I do not use any <pre> tags inside my projects, so there could be Xdebug that are causing the html formatting maybe?
Industrial
+1  A: 

Consider setting PHP's error_log configuration variable -- it can be helpful when you have code setting error_reporting() without your knowledge. Then you can check the error log and see what errors, if any, occurred.

Josh
Error log is set and working, but nothing is outputted in the event of a white screen of death...
Industrial
Hmmm... I'm not sure what else to suggest that hasn't already been suggested. Sorry :-/
Josh
If something's breaking things so badly that PHP itself dies and can't log anything, it MAY get logged in the webserver's own error_log instead.
Marc B
+1  A: 

Ensure that there's no whitespace in your files output outside of the CI buffer, especially if compression is turned on. You can test this by turning off compression in your CI config file.

See step two at: http://codeigniter.com/user_guide/installation/upgrade_141.html (Note that while this is for the upgrade, it contains a snippet of the config file which explains the problem.)

Kurucu
No whitespace in the files and GZIP is off!
Industrial
In a way, it's a pity because it would have been a simple fix! Good luck.Note to other readers with the same question: this solution might still solve your problem!
Kurucu
+1  A: 

Make sure your logs and cache folder inside /system are chmod'ed to 777.

Phil Sturgeon
Yeps, everything CHMOD:ed correctly
Industrial
+1  A: 

Grep the files for 'error_reporting', and 'display_errors', the application might turn it off somewhere.

Also, to be able to see parse errors, you need to set error_reporting/display_errors in the php.ini file, or a .htaccess file, setting it in the script files will not do, and will lead to the white page you describe if there are parsing errors.

WishCow
Industrial
Are you sure that the file that you are looking at is executed? Can you put a die('Hello world') at the top and observe the output?
WishCow
+2  A: 

The best thing is to have a checklist of the common problems that could cause this since CI's default is already

error_reporting(E_ALL);
  1. Same name controllers and models
  2. using reserved words as methods

list goes on..

Thorpe Obazee
Hi! Yep, I've got a clue on the reasons for white screens to occur, the question were more about if there's any good ways to prevent them from being white and outputting errors instead...
Industrial
+1  A: 

Aside from everything else posted, also make sure that something masked with the @ (error suppression operator) isn't throwing a fatal error.

Kenaniah
Yep! Done that already :(
Industrial