Problem scenario
Using a web browser you go to a PHP web page. There are no errors, but the page is blank. It is just all white, but you expect content to be rendered (e.g., text should be visible). The WSOD (white screen of death) is a common problem to troubleshoot in a web browser. What do you do to see output you want it to display?
Solution
1. Did you forget a semicolon ";"? Some tags or HTML sections can make even a careful programmer's brain skip over a line that needs a semicolon. Go to the source .php file. Look for a missing semi-colon at the end of a line. Omitting a closing semi-colon can make the page render just white. Add the semi-colon on the line that needs it. Save the file. Go back to the browser and refresh the page. Remember that a semi-colon may appear at the end of a line, but if it is after a closing brace "}", you may need a semi-colon before the terminating close brace. If you accidentally forgot a semicolon or commented one out, this could cause the page to be blank.
2. Did you forget a closing brace? With conditional statements (e.g., if, for, or while), there needs to be a closing brace. If you accidentally forgot one or commented one out, this could cause the page to be blank.
3. See if there is an extra <?php in your code. An unclosed <?php string (with no corresponding ?>) can render a PHP page blank or white.
4. See if there is an extra */ in your code. An unopened */ two-character string (with no corresponding /*) can render a PHP page blank or white. Alternatively, an unclosed multi-line comment opener /* can also cause this problem.
5. If you are using pg_query commands, are you using a variable? If so, the variable expansion of the SQL query should have no quotes in the variable itself. Normally you'll see something like this:
pg_query("select * from goodtable;");
The above works. However, if you want to have a variable for your pg_query, it should not have double quotes. It should be like this:
$query = 'select * from goodtable;';
pg_query($query);
6. Are you using session_start(), session_set(), or $_SESSION in your code? These can be used improperly to cause a page to appear blank. If you are using these functions, see this link.
7. Did you forget to use session_start? If variables are referenced later on that relied on this function call, your PHP page may be blank.
8. The PHP variables (e.g., $varname) involved in the display were not assigned a variable (because of a typo in the code or either because of the result of a deterministic or non-deterministic algorithm). If you tried to concatenate a variable but forgot to place a period ".", this can cause the entire page to be blank. If you have a space where there should be a period, this variable assignment may cause the entire PHP page to appear white with no content. If you have complex lines that you suspect are causing the problem, try commenting out specific lines to see if some content comes back (i.e., put "//" (with no quotes) before the line of PHP code. This can help you narrow down a seemingly elusive problem.
9. The page could be blank by design. Are you sure it is not supposed to be blank? Some PHP pages have no HTML to be presented. Examine the code and see if the intended rendering is actually not viewable. Maybe the web page (via the PHP code) is supposed to be blank as it is coded. If your PHP is showing the underlying code in a way that you do not expect (e.g., you see text or raw PHP code when you want to see a publicly presentable and beautifully-rendered web page), see this posting.
10. Is your PHP program using Linux Bash commands? If so, see this posting.
11. Try this link for more suggestions.