Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,371 members, 7,800,747 topics. Date: Thursday, 18 April 2024 at 05:21 AM

PHP: Five Common Causes Of White Screen Of Death - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / PHP: Five Common Causes Of White Screen Of Death (1122 Views)

Programmer’s Writer’s Block: Causes And Solutions / White Screen Error Solved & Getting Whoops! Back In Laravel 5 (2) (3) (4)

(1) (Reply)

PHP: Five Common Causes Of White Screen Of Death by youngfellow: 12:07am On Nov 07, 2015
if you get messy with php codes u might have experience this, after writing ur lines of good code (almost) only 2 get a blank screen after hitting go. It hurts.
1. Turning off display_errors.
This is a good pratice for production site but might work against u during development cause when a fatal error occurs, there wont be any means to print out the error, and everything will just go blank.
Solution: turn on display_errors in php.ini or comment out display_errors e.g
// @ini_set('display_errors',0);
or
// error_reporting(0);
so u wont forget to turn it off when finalizing ur work.
2. The wicked @.
My bad, i meant to say the good @ (seriously). Apart from turning off display_errors, one can also place an @ symbol (error suppress operator) in front of any function or even variable which is likely to throw an error in order to silent it (yeah, stop it from screaming errors) eg @setcookie, @$_SERVER, @mysqli_* (pls use PDO). I have also fall for this once (when i disabled syntex highlightìng from my editor, my mistake), after writing @int_set instead of @ini_set (int - too much of java) and the worst part of it all was that it was in an included file, not the main file i was running.
Solution: leave all @ till when u are finilizing ur development (if u really need 2 use it).
3 Empty Whitespace (like seriously).
I love leaving empty whitespace while coding for easy scrolling and i av never experience any error regarding this issue, but some developers claim that leaving empty whitespace causes WSOD (Suprising).
Solution: first delete all empty whitespace whenever you experience WSOD in order to be double sure.
4. Invisible errors.
Some developers claim that some php errors might appear in a bad html
eg <html><body></body></html> //i am an invisible error.
Although i av never experience this, but i think it worth discussing.
Solution: alway view source code from ur browser or use another browser.
5 i cant know it all, add urs. mind u, always check ur error log for errors (that is, if u enable error logging).
Re: PHP: Five Common Causes Of White Screen Of Death by fattbabakay(m): 7:02am On Nov 07, 2015
I also got to know that leaving white spaces at the end of the closing tag ?> also causes WSOD...
Re: PHP: Five Common Causes Of White Screen Of Death by youngfellow: 4:52pm On Nov 07, 2015
fattbabakay:
I also got to know that leaving white spaces at the end of the closing tag ?> also causes WSOD...
yeah, maybe it's better if it is left after the closing tag.

(1) (Reply)

Contract Html/ui Developer / Get Programming And Web Development Tutorial Videos At A Very Cheap Price / Aww Yeah, Bootstrap 4 Is Here!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.