Debugging PHP Scripts
Views:
Author: Chris

<?php

ini_set
(‘display_errors’1);

#temp. config your php.ini file for displaying errors

#you may also edit your PHP.ini file and change this manually

error_reporting (E_ALL & ~E_NOTICE);

#display errors

?>



Using error_reporting(); you can limit what errors are reported. Here’s a list of reporting levels you can use, just type error_reporting(E_YOUR CHOICE); or if you want to use more than one use error_reporting(E_YOUR CHOICE & E_YOUR SECOND CHOICE);
etc, make sure you keep intact ini_set();

E_ALL —- All errors
E_STRICT —- Recommendations and E_ALL
E_ERROR —- Run-time errors (stops the execution of a script)
E_WARNING —- Run-time warnings (does not stop the execution)
E_PRASE —- Prase Errors
E_NOTICE —- Notices (things that may or may not be problems with your script(s))
E_USER_ERROR —- User-generated errors, used by the trigger_error(); function
E_USER_WARNINGS —- Same as above, just warnings
E_USER_NOTICE —- Same again, just notices

If you are using E_ALL and don’t want to report errors from other types of error reporting you can set it out like this
error_reporting(E_ALL & ~E_THE CHOICE THAT IS NOT WANTED);
~ means discard.

Hope this helps you out a bit, comments welcome, by the way, I usually use E_ALL and if there are no errors but still issues I use E_STRICT.

Back to the Start...

1 2



Comments
You must be logged in or register an account with us before posting a comment.

Daud
Nice, thanks
Statistics
Member Stats Online Members, read legend below: .
Registered Users: 5 registered AND activated.
Member Level Legend NOTE: If the username is underlined it means they may just have the page open and not actually be surfing the site. Administrator
Home

Membership Login

Shout Box

» GO FULL!
Please login to post a shout. » Turn OFF chat!

Point Leader board

© Copyright 2006 - 2008 Tutnation.com and ChrisTheFeral.com