Categorized | News

Error Handling In PHP

Posted on 31 August 2002 by Demian Turner

from Devshed
You might not know this, but PHP comes with a full-featured error handling API, which provides you with a number of options when it comes to trapping and resolving errors. Not only does PHP allow you to decide which types of errors get displayed to the user, but it also allows you to bypass its internal error handler in favour of your own custom functions, thereby opening up all sorts of possibilities for the creative developer.

Bookmark and Share

3 Comments For This Post

  1. Anonymous Says:

    I usually get the mySQL error 1064 and yes, the SQL is displayed so I can usually figure out the SQL error – BUT, it would be real nice if I could also see the PHP program name and line# of the error.

    Besides using an IDE – have you see mysql Classes or PHP coding style that handled this?

  2. demian Says:

    here is a general debug class that gives *detailed* error messages:

    http://xdebug.derickrethans.nl/

    though I\’m not sure if includes MySQL info. There is also Thomas V. Cox\’s tutorial that explains how to get very detailed MySQL errors if you\’re using the PEAR library – but I don\’t think it isolates the line number in the code:

    http://vulcanonet.com/soft/?pack=pear_tut#ss5

    I\’m using this one at the moment and would recommend it.

  3. efarmboy Says:

    Nice – I was able to compile xdebug on my FreeBSD 4.5 PHP 4.1.1 system without any problems and worked cleanly.

    It sure does give you a fair amount of output – albeit GL will complain about the headers. The trace output to a file is nice as well.
    It\’s a nice addition to the set of tools.

    Blaine

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook