Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php debugging question???

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Can some seasoned php programmers recommend a method to examine variables and mysql return codes during testing???

I've been tryin error_log() along with mysql_error() with no output.

I've set the error_reporting = error_log
and the error_log = /var/log/lasdflsdf

in the php.ini file followed by a restart of apache. Still no logs.

Any recommendations please???

Bob
 
Have you tried 'log_errors = On', in php.ini?

For my debugging, I created a database access class (or you can use one of the many available DB abstraction classes), which allowed me to set my error output from one location. Then, I could choose to output in HTML comments (<!-- [sql + error] -->) or to log it to the PHP error log.

One thing that is useful for debugging: PHP has two magic constants called __LINE__ and __FILE__, which are of course the current line number, and the current file where the code is called. Now, if you want to know exactly where the error is happening, you can call your database class along with those two parameters:
Code:
$db->executeQuery($sql, __LINE__, __FILE__);
If you have set up your class or functions to handle those arguments, you can have some nice fine-grained debugging. -------------------------------------------

&quot;Now, this might cause some discomfort...&quot;
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top