Instructions:
- Download the APD debugger
- untar it
- run 'phpize' in the directory
- ./configure
- make install (and with any luck it will install the php_apd.so module into your php modules directory.)
- edit the php.ini file and add the line (you need the full path)
zend_extension_debug=/usr/lib/php/2001...../php_apd.so
- try out this little test program:
#!/usr/bin/php -q
<?
apd_set_session_trace_socket("localhost", APD_AF_INET, 7777, 35);
apd_breakpoint(9);
for ($i=0;$i<10;$i++) {
echo "TEXT\n";
}
?>
- get hold of tcplisten
(it's a socket listening program on linux - kind of like a reverse version of telnet)
bash#tcplisten localhost 7777
- now run the file like this (you need the -e for the breakpoints to work!)
bash#/usr/bin/php -e
test.php
- the
program will start up and hang, meanwhile in the tcplisten window you
will see this. (the bold stuff is an example of what you can type in...
APD - Advanced PHP Debugger Trace File
---------------------------------------------------------------------------
Process Pid (6118)
Trace Begun at Sun Mar 10 23:13:12 2002
---------------------------------------------------------------------------
( 0.000000): apd_set_session_trace called at /home/alan/Projects/project2/test.
php:5
( 0.074824): apd_set_session_trace_socket() at /home/alan/Projects/project2/tes
t.php:5 returned. Elapsed (0.074824)
( 0.074918): apd_breakpoint() /home/alan/Projects/project2/test.php:7
++ argv[0] $(??) = 9
apd_breakpoint() at /home/alan/Projects/project2/test.php:7 returned. Elapsed (
-2089521468.1073275368)
>
\n
(enter steps through the program)
statement: /home/alan/Projects/project2/test.php:8
>
\n
(enter steps through the program)
statement: /home/alan/Projects/project2/test.php:8
>
\n
(enter steps through the program)
statement: /home/alan/Projects/project2/test.php:10
>
apd_echo($i);
EXEC: apd_echo($i);
0
0
>
apd_echo(serialize(apd_get_active_symbols()));
EXEC: apd_echo(serialize(apd_get_active_symbols()));
a:47:{i:0;s:4:"PWD";i:1;s:10:"COLORFGBG";i:2;s:11:"XAUTHORITY";i:3;s:14:"
COLORTERM_BCE";i:4;s:9:"WINDOWID";i:5;s:14:"ETERM_VERSION";i:6;s:16:"SE
SSION_MANAGER";i:7;s:4:"PS1";i:8;s:11:"GDMSESSION";i:9;s:5:"USER";i:10;s:5:"
MAIL";i:11;s:7:"OLDPWD";i:12;s:5:"LANG";i:13;s:10:"COLORTERM";i:14;s:8:"DISP
LAY";i:15;s:8:"LOGNAME";i:16;s:6:"
apd_echo(system('ls /home/mydir'));
........
apd_continue();