没有不值得去解决的问题,也没有不值得去学习的技术!

How to Debug PHP Source Code in NetBeans IDE 8.1

When starting the debugging session again, the debugger window now shows that it is running

1. When starting a debugging session, a set of debugger windows opens below the main editor window. In the debugger window, it keeps prompting “Waiting for connection” (netbeans-xdebug), as shown in Figure 1;

When starting a debugging session, a set of debugger windows opens below the main editor window. In the debugger window, it keeps prompting "Waiting for connection" (netbeans-xdebug)
Figure 1

2. Analysis reveals the “Debugging” tab in the “PHP” options, which shows the Session ID. This is an arbitrary name for the debugging session. By default, it is netbeans-xdebug, as shown in Figure 2;

Analysis reveals the "Debugging" tab in the "PHP" options, which shows the Session ID. This is an arbitrary name for the debugging session. By default, it is netbeans-xdebug
Figure 2

3. Check the xdebug.idekey property in php.ini, which is currently set to: PPB07$, as shown in Figure 3;

Check the xdebug.idekey property in php.ini, which is currently set to: PPB07$
Figure 3

4. Set the xdebug.idekey property value in php.ini to: netbeans-xdebug, as shown in Figures 4 and 5;

Set the xdebug.idekey property value in php.ini to: netbeans-xdebug
Figure 4
Set the xdebug.idekey property value in php.ini to: netbeans-xdebug
Figure 5

5. When starting the debugging session again, the debugger window still keeps prompting “Waiting for connection” (netbeans-xdebug), as shown in Figure 6;

When starting the debugging session again, the debugger window still keeps prompting "Waiting for connection" (netbeans-xdebug)
Figure 6

6. In the General tab of the “PHP” options, reset the PHP 5 interpreter, as shown in Figures 7 and 8;

In the General tab of the "PHP" options, reset the PHP 5 interpreter
Figure 7
In the General tab of the "PHP" options, reset the PHP 5 interpreter
Figure 8

7. When starting the debugging session again, the debugger window still keeps prompting “Waiting for connection” (netbeans-xdebug);

8. Set the xdebug.remote_enable property value in php.ini to: 1, as shown in Figure 9;

Set the xdebug.remote_enable property value in php.ini to: 1
Figure 9

9. When starting the debugging session again, the debugger window still keeps prompting “Waiting for connection” (netbeans-xdebug);

10. Set the xdebug.remote_host property value in php.ini to: 127.0.0.1, as shown in Figure 10;

Set the xdebug.remote_host property value in php.ini to: 127.0.0.1
Figure 10

11. When starting the debugging session again, the debugger window now shows that it is running, as shown in Figure 11;

When starting the debugging session again, the debugger window now shows that it is running
Figure 11

Note: The xdebug.idekey in php.ini can be commented out, and it will still run normally. However, if you choose to set it (such as in certain remote debugging scenarios), you must pay attention to this value;

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系