faqts : Computers : Programming : Languages : PHP : Common Problems : Errors

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 16 people (81%) answered Yes
Recently 2 of 5 people (40%) answered Yes

Entry

Why can't I get the PHP debugger to work?
How do I enable the debugger for PHP?

Jul 7th, 1999 20:57
Nathan Wallace, Teodor Cimpoesu


1. First, check if you have compiled php with debugger support. You must
see a line like "debugger- no aditional information" with phpinfo().
I think 3.0.11 configure script don't really turn it on even if you say
--enable-debugger so after configuring take a look in config.h for
PHP_DEBUGGER 1 or something.

2. edit php3.ini and set 

    debugger.host = your_host
    debugger.port = a port ( like 7654)
    debugger.enabled = true

3. set a listener to that port. I use netcat, given by a pal from the
list.  I set it like in a script called debugger.sh

    [debugger.sh]
    nc -l -p 7654 >> debugger_log
    echo -e " ------------ end log -----------";

Because after debugger closes connection to the port nc finishes too, I
set this line in /etc/inittab:

    rc:2345:respawn:/path/to/debugger.sh

so everytime it dies, a new listener is created.

4. use debugger_on("your_host"); to enable it.

5. run steps 4-1 backward and undo all, cause you don't need all that
output from debugger.  You cannot set error report level so every notice
will be there, most mega with something like "notice: variable
unitialized before use" or something.

6. unless you skipped #5 and you really need such a tool for a short
time consider using it.

Other useful debugging features are system logs (see error_log).