Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run PHP script get Blank screen in browser

Status
Not open for further replies.

sen5241b

IS-IT--Management
Sep 27, 2007
199
US
I have been getting a lot of blank screens lately when trying to run a PHP script with the slightest error. Firefox shows a blank screen but IE produces "The page cannot be displayed There is a problem with the page you are trying to reach and it cannot be displayed " for the same script.

I determined that OS permission problems on the script itself will cause this issue but so do un-closed braces and missing semi-colons. On my other servers I never got this behavior. I tried re-building my entire server with a new version and distro of Linux but the same thing happens. I also put the following in my code to no avail. :

Code:
error_reporting(E_ALL);
ini_set('display_errors', true);

Only some scripts give the blank screens. Others do not. All help most appreciated.
 
FOOTNOTE: PHP script errors DO appear in /var/log/apache2/error.log
 
the blank screens often occur because error suppression is turned on AND a startup error occurs.

edit the php.ini file and change the show start up errors to true and make sure that error display and error reporting are turned on in the file. then reboot the server.

as a tip, use a php editor to parse the file for missing braces. or even better, use the alternative syntax for control structures to reduce the likelihood of a missing brace.

if you have no php editor then you can use the command line to check syntax.
Code:
php -l myfile.php
 
I assume you turn on error suppression when you are confident with your production web server so users don't see errors.
 
I changed the php.ini setting to display startup errors and rebooted but I still see the white screen of death. Php errors DO go into error.log. What else could cuase this?
 
Fixed - had to set display_errors to on also
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top