Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White screen of death!

After debugging a CodeIgniter application 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 has 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 cause this.

Reference: Why does Code Igniter give me a white page?

like image 739
Industrial Avatar asked May 26 '10 15:05

Industrial


4 Answers

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

like image 195
Mark Baker Avatar answered Nov 18 '22 11:11

Mark Baker


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.

like image 40
Dolph Avatar answered Nov 18 '22 12:11

Dolph


I've found out, since the time of my question, that nothing seems to ensure that errors are always outputted with PHP, which seems to throw white screens here and there. Regardless of PHP's ini-settings.

I've found out that the best workaround however is to use the following line to ensure that error logging is put into a file easily is accessed and monitored by the application:

ini_set('error_log', MYPATH .'logs/errorlog.log');

As far as I've tested it, when white screens appear - it also gets logged into this errorlog. It seems to be the easiest way to know what happens when things go wrong.

like image 4
Industrial Avatar answered Nov 18 '22 11:11

Industrial


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.

like image 3
K. Norbert Avatar answered Nov 18 '22 11:11

K. Norbert