White screen of death!

左心房为你撑大大i 提交于 2019-11-29 07:28:35

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

Dolph

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.

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 accessed and monitoredby 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. Seems to be the easiest way to know what happens when things go wrong.

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.

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..

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

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.

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

I had this problem on my freshly installed server. Debian 7. I enabled logging, error reporting, disabled gzip and so on.

However, my PHP-installation did not have MySQL enabled. Enabling MySQL did the trick for me.

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.)

Have you by chance happen to create a cached output for that particular method inside your controller. Because if so, then it may create a cached version of the page and practically that page is not even running. The cached error output page is showing up. Please check your cache folder inside the application. It should only contain the index.html file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!