Linux 中的 Netbeans 和 Xdebug

2021-12-26 00:00:00 linux xdebug netbeans

我已经安装了 Xdebug,我可以从 phpinfo() 确认它已正确安装.我已经采取了所有在我 googlenetbeans xdebug 安装等"中提出的网站中给出的所有步骤.

I have installed Xdebug, and I can confirm from phpinfo() that it is correctly installed. I have taken all the steps given in all of the sites that come up with I google "netbeans xdebug install, etc".

它在 Netbeans 中仍然不起作用.有人可以提供任何建议吗?

It still does not work in Netbeans. Is there any advice that someone can offer?

这是我的 php.ini 调试部分...

Here is my php.ini debug section...

[xdebug]
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_mode = "req"
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.idekey = "netbeans-xdebug"

任何帮助将不胜感激!

推荐答案

由于我能得到的信息非常稀少,我必须更详细地描述设置.

Since the information available to me is very sparse, I have to describe the settings in more detail.

Netbeans 和 xdebug 设置.

Ubuntu 12.04 LTS 精确穿山甲

Ubuntu 12.04 LTS Precise Pangolin

应该安装什么.

全局设置:

工具 -- 选项

PHP 设置:

使用 phpinfo() 你会得到.. 见下图.

With phpinfo() you get.. see below image.

只有一个 php.ini 很重要!查看加载的配置文件如果您将 xdebug 条目写入另一个php.ini"文件,请确保再次清除所有这些条目.( xdebug 仅在一个 php.ini 中).另请查看解析的其他 .ini 文件.我们稍后再谈.

Only one php.ini is important ! Look at Loaded Configuration File If you wrote a xdebug entry into another "php.ini" file be sure to clear all these entries again. ( xdebug ONLY in one php.ini ). Look also at Additional .ini files parsed. We come to this later.

zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000

已解析其他 .ini 文件.
添加或控制,只有第一行必须与php.ini"中的相同.(没有")

Additional .ini files parsed.
Add or controlling, only the first line must be the same as in the "php.ini".( Without " " )

确保文件确实在那里!

确保 session.save_path 确实存在!

控制 xdebug 版本应该等于或更高.(匹配 PHP 版本 5.3.10-1).如果一切都按照本答案中的描述完成,但它不起作用,那么很可能不正确或有缺陷xdebug.so".

Control the xdebug version that should be equal to or greater.( Matching PHP Version-5.3.10-1 ). If everything was done as described in this answer, and it does not work, then it is with great probability of an incorrect or defective "xdebug.so".

创建一个新的 PHP 项目:

项目属性:
来源
在我们的测试程序中,重要项目文件夹和源文件夹完全相同!

Project Properties:
Sources
In our test program, it is important the Project Folder and Source Folder are exactly alike!

运行配置

开始调试: -- 按下调试按钮

当 Netbeans 处于调试模式时,默认浏览器会打开并保持在 正在连接 .. 状态.
(如果 Netbeans 没有打开浏览器或无法连接,请返回高级 Web 配置并选择不要打开 Web 浏览器.关闭并重新打开浏览器并输入 URL如下所示)

The default Browser opens and remains at Connecting .. stand while Netbeans in debug mode is.
(If Netbeans do not open a Browser or can not connect, go back to Advanced Web Configuration and select Do Not Open Web Browser. Close an reopen the browser and type the URL as seen below)

检查您的代码.完成调试后,您将只在浏览器中看到一些内容.不要忘记按下停止按钮 .如果你忘记了这个 xdebug 正在运行.

Go through your code. You will see only something in the browser when you're done with the debugging. Don't forget to press the Stop Button . If you forget this xdebug is running on.

完成:

相关文章