Turn on PHP Page Error Reporting

I write a ton of code in PHP and sometimes despite best efforts things go wrong. This is where page level error reporting will save the day. If you have just pounded out a whack of PHP code and are getting a blank white screen it is likely you have yourself a creepy critter in your code.

The easiest way to find it is to enable on page php error reporting and the following snippet will save the day;

error_reporting(E_ALL);
ini_set('display_errors', 'on');

If you do enable this small snipppet of code keep in mind that you may get quite a few non critical errors as well as the ones that are causing your page to break. Case and point when I use this snippet on a WordPress Blog I always manage to find at least 10 errors per page that wont break the site but that should be fixed at some point.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s