debugging server service code

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
usually it is handy to debug PHP programs using print_r() or
var_dump(), as they can print out all the variables you need and the
web browser can show any run time error message.  But what if it is
the situation when the php file is providing info to the Javascript
either as an AJAX call or even more so, as an OpenSocial's service --
in those case, there is a bunch of parameters provided to the PHP file
and it is really hard to mimic a session using ... with
possible data posted to the PHP file.

In those situation, we can write any variable to a file using
var_export() and a write function as a debug log... but what if there
is any run time error...  is there a way to redirect all those info
also to a file, or somehow be able to see the run time error and stack

Any possible solution?  Thanks for your help!

Re: debugging server service code wrote:
Quoted text here. Click to load it

You can set a log file in your php.ini file which will log php-detected
errors instead of displaying them.

I have it on on my development system, just so I can go back and look at
the errors if I need to.  I just clean it up every few days (I make LOTS
of typing errors :-)= ).

It's also a good idea to have it on your production system and check it
on a regular basis to ensure there are no unexpected errors.  I
generally have a cron job check the size and mail it to me of non-zero
on a daily basis, then rotate it with the rest of the log files.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: debugging server service code wrote:
Quoted text here. Click to load it

Further to Jerry's suggestions, you can also setup your own error handler

Site Timeline