dongnaoben4456 2010-04-11 04:49
浏览 83
已采纳

使用GDB调试PHP解释器

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
    关注
    1. You want to get your hands on a debug build of mod_php (with symbols) or build your own (configure --enable-debug)
    2. 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 and StartServers all to 1. Also make sure any timeout parameters are generously set
    3. Use gdb or any graphical interface to gdb (such as ddd 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.
    4. 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 and gdb will normally oblige you.

    Have fun!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料