Science, Tech, Math › Computer Science Why Did My PHP Page Load All White? Tips for Preventing and Troubleshooting Blank PHP Webpages Share Flipboard Email Print Nenad Aksic/E+/Getty Images Computer Science PHP Programming Tutorials MySQL Commands Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Angela Bradley Angela Bradley Computer Science Expert B.A, History, Eastern Oregon University Angela Bradley is a web designer and programming expert with over 15 years of experience. An expert in iOS software design and development, she specializes in building technical hybrid platforms. Learn about our Editorial Process Updated on July 10, 2019 You upload your PHP web page and go to view it. Instead of seeing what you expected, you see nothing. A blank screen (often white), no data, no error, no title, nothing. You view the source ... it's blank. What happened? Missing Code The most common reason for a blank page is that the script is missing a character. If you left out a ' or } or ; somewhere, your PHP won't work. You don't get an error; you just get a blank screen. There is nothing more frustrating than looking through thousands of lines of code for the one missing semicolon that is messing the whole thing up. What can be done to correct and prevent this from happening? Turn on PHP Error Reporting. You can learn a lot about what is going wrong from the error messages PHP gives you. If you aren't currently getting error messages, you should turn on PHP error reporting. Test your code often. If you test each piece as you add it, then when you encounter a problem, you know the specific section to troubleshoot. It'll be in whatever you just added or changed. Try a color-coded editor. A lot of PHP editors—even free ones—color code your PHP as you enter it. This helps you pick out lines that don't end because you'll have large chunks of code in the same color. It's non-intrusive for programmers who prefer to code with no bells and whistles but helpful when troubleshooting. Comment it out. One way to isolate the problem is to comment out large chunks of your code. Start at the top and comment out all but the first couple of lines in a large block. Then echo () a test message for the section. If it echoes fine, the problem is in a section further down in the code. Move the start of your comment and your test echo downward as you work through your document, until you find the problem. If Your Site Uses Loops If you use loops in your code, it could be that your page is stuck in a loop that never stops loading. You may have forgotten to add ++ to the counter at the end of a loop, so the loop continues to run forever. You may have added it to the counter but then accidentally overwritten it at the start of the next loop, so you never gain any ground. One way to help you spot this is to echo() the current counter number or other useful information at the beginning of each cycle. This way you might get a better idea of where the loop is tripping up. If Your Site Doesn't Use Loops Check that any HTML or Java you use on your page isn't causing a problem and that any included pages are without error. Cite this Article Format mla apa chicago Your Citation Bradley, Angela. "Why Did My PHP Page Load All White?" ThoughtCo, Feb. 16, 2021, thoughtco.com/my-page-has-loaded-all-white-2694199. Bradley, Angela. (2021, February 16). Why Did My PHP Page Load All White? Retrieved from https://www.thoughtco.com/my-page-has-loaded-all-white-2694199 Bradley, Angela. "Why Did My PHP Page Load All White?" ThoughtCo. https://www.thoughtco.com/my-page-has-loaded-all-white-2694199 (accessed June 1, 2023). copy citation