I would like to use GDB to step though the C++ code that makes up the php.so Apache extension. I want to see what PHP is doing while it's running a PHP application. Preferably I would use an IDE like Netbeans or Eclipse on a LAMP system.
2条回答 默认 最新
- dongyong9224 2010-04-11 05:27关注
- You want to get your hands on a debug build of
mod_php
(with symbols) or build your own (configure --enable-debug
) - You should configure your Apache to always keep exactly one worker process instance up (which will be the instance you debug), that is, set
MinSpareServers
,MaxSpareServers
andStartServers
all to 1. Also make sure any timeout parameters are generously set -
Use
gdb
or any graphical interface togdb
(such asddd
or Eclipse CDT) to attach to the one and only Apache worker process. Stick a breakpoint in one of the PHP sources etc. and continue. - Point your browser to your webserver and access a PHP page. Your breakpoint will trigger. If you want to wake the debugger at a particular point in your PHP script execution, generate a
SIGTRAP
from PHP andgdb
will normally oblige you.
Have fun!
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报 - You want to get your hands on a debug build of