Forgot Password / Register
Site Statistics
Total Members: 510
Total Tutorials: 242
Newsest User: Hp
Todays Unique Hits: 127
0 Users 1 Guests Online

PHP Debugging Techniques

PHP Code
1
2
3
4
5
6
7
8
<?
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 to what errors are reported.

Here is a list of reporting levels you can use, just code 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 dont want to report errors from other types of error reporting you can set it out like this
error_reporting(E_ALL & ~E_YOUR CHOICE);
~ means not.

hope this helps you out a bit, comments welcome, by the way, I ussually use E_ALL and if no errors I use E_STRICT.
chrism
Author:
Views:
1451
Rating:
There are currently no comments for this tutorial.