php script returns blank page

November 12, 2007

A common thing you see reported on php forums is someone tries to do something, and just gets a blank page. Has happened to me a few times, and puzzled me at first, but usually the problem is a fatal error in your code where error reporting is turned off in the server (recommended behaviour for live servers), so the page just returns blank.

Makes the code damn hard to debug, but sometimes you can get at the error log – make a file with the function phpinfo() in it and it’ll tell you where the error log is, if you have shell access to the server you can go in and take a look. If you don’t … well, you’re supposed to be able to change the error reporting settings within a script using ini_set() or error_reporting() but that hasn’t worked for me in the past. Obviously it helps if you’re doing your development on a development server where you can change the error settings on the server itself – if you’re not, you should be, WAMP is a breeze to set up on your desktop and it makes your life much easier – but even when something works fine locally you can get problems when you go live … if that happens you’ve no option but to just try and figure it out without any error messages.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: