dpdp42233 2014-01-24 10:49
浏览 63
已采纳

我如何在NetBeans中调试PHP

  • I am using Wamp server to run Apache and PHP.
  • I am using NetBeans PHP as my IDE.

I would like to turn on the debugger, I imagined that either:

  • Apache and PHP would need to know that I want them to tell my NetBeans that they have loaded a page and thus it should be listening for when it can fire a breakpoints
  • That Netbeans needs to tell Apache and PHP that it has a breakpoint it should pause on.

I have been changing various bits and bobs trying to get the debugger to work in NetBeans All of which seems to have been in the php.ini file:

zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"

[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

I really do not understand what the above is doing but I've been following tutorial after tutorial and getting no where.

What ends up happening is that I press the run button in Netbeans, the debugger part keeps saying connecting, while my browser has already loaded the page and presented everything, ignoring the fact I wanted to break at a point.

Any ideas?

  • 写回答

2条回答 默认 最新

  • douxin1884 2014-01-24 11:18
    关注

    When you install netbeans it automatically adds these lines to your PHP.ini file (C:\wamp\bin\apache{your-version-of-apache}\bin\php.ini), as James has described.

    To fix the issue of netbeans saying "waiting for connection to netbeans-xdebug" follow the few steps bellow.

    1. Remove the lChange the following lines in the php.ini file to

      zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"

      [xdebug]

      xdebug.remote_enable = 1

      xdebud.idekey="netbeans-xdebug"

      xdebug.profiler_enable = 1

    2. In netbeans click tools > Options > php > debugging

    Make sure the debugger port is 9000 and session id is netbeans-xdebug

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

报告相同问题?

悬赏问题

  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同