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

我如何在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?

图片转代码服务由CSDN问答提供 功能建议

  • 我使用Wamp服务器运行Apache和PHP。
  • 我使用NetBeans PHP作为我的IDE。

    我想打开调试器,我想到了: / p>

    • Apache和PHP需要知道我希望他们告诉我的NetBeans他们已经加载了一个页面,因此它应该在它可以触发断点时监听< / li>
    • Netbeans需要告诉Apache和PHP它有一个应该暂停的断点。

      我一直在改变各种位和 试图让调试器在NetBeans中工作的bob 其中的所有内容似乎都在php.ini文件中:

        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”
         
       
       

      我真的不明白上面做了什么,但我 在教程和g之后一直关注教程 最后发生的事情是我按下Netbeans中的运行按钮,调试器部分一直在说连接,而我的浏览器已经加载了页面并显示了所有内容,忽略了 事实上我想突破一点。

      任何想法?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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

    已采纳该答案
    打赏 评论
  • doulong6761 2014-03-09 12:50

    I had a similar issue and came across a post to fix the problem. My html form (testform.html) was calling a php script (runQuery.php) and Netbeans could not break at the set break points in my runQuery.php

    After checking all the configuration settings in php.ini and Netbeans by searching on forums like this one, I discovered that netbeans will only break on the break points if the Index file for the project is a PHP file. This is very important otherwise you will spend hours trying to figure out why break points are not working.

    In Netbeans go into the File/Project Properties/Run Configuration and check that the Index file is a PHP file. In my case I changed my index file from testform.html to testform.php and it worked, I was able to break on break points.

    打赏 评论

相关推荐 更多相似问题