ubuntu 中使用 netbeans 进行 php 调试
我无法使 netbeans 6.9 与 xdebug 一起工作。奇怪的是我尝试了 telnet
nerkn@nerkn-laptop:~/www/nerkl$ telnet localhost 9000
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
nerkn@nerkn-laptop:~/www/nerkl$ telnet bogaz 9000
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
也找不到 debugclient。
xdebug 正在工作:我得到了日志记录和漂亮的错误报告。
我能做些什么? 我只想要一个基本的逐步跟踪。
I cant make netbeans 6.9 work with xdebug. Strangely I tried telnet
nerkn@nerkn-laptop:~/www/nerkl$ telnet localhost 9000
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
nerkn@nerkn-laptop:~/www/nerkl$ telnet bogaz 9000
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
also I cant find debugclient.
xdebug is working: I got logging and pretty error reporting.
What can I do?
I just want a basic step by step trace.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要启用远程调试。
在 xdebug.ini 中尝试一下:
You need to enable remote debugging.
Try this in
xdebug.ini
:对我有用的解决方案;解决了netbeans的调试问题,它没有解决telnet“连接被拒绝”问题。
我的解决方案:
在 php.ini 文件中(即位于 /etc/php/7.2/apache2/php.ini 中);注释 [xdebug] 部分(通常是文件末尾的最后一部分)中的选项
,然后重新启动 apache 服务,
如果启用了此选项并且您禁用了它,请尝试重新启动 netbeans。
@troelskn 它不是 xdebug.ini 文件;它是 php.ini 文件。
注意:如果现在 Xdebug 只适用于 php 7.2。 (请仅使用uptil Xdebug 2.6,因为更高版本在调试方面存在一些问题)。
因此,如果您安装了任何其他版本,例如 php 7.3 或 7.4,那么 oyu 还必须安装 php 7.2 以及您当前的 php 版本(主要是因为现在默认情况下最新版本是通过 apt 安装的)。然后在替代方案之间进行更新。
要将 PHP 7.0 设置为默认值,请运行
将 PHP 7.2 设置为默认值,请运行
将 PHP 7.3 设置为默认值,请运行
将 PHP 7.4 设置为默认值,请运行
在配置 Apache 使用 PHP 7.2 之前,我们需要禁用 的
现在,使用以下命令启用新安装
PHP 7.2 版本:重新启动 Apache Web 服务器以使更改生效:
The solution that worked for me; solved the debugging issue of netbeans it did not solved telnet "Connection refused" issue.
My solution:
In php.ini file (i.e. located in /etc/php/7.2/apache2/php.ini); comment the option in [xdebug] section (usually the last section at the end of the file)
then restart the apache service
try restarting the netbeans if this option was enabled and you disabled it.
@troelskn it not the xdebug.ini file; it is php.ini file.
Caution: If for now Xdebug only work with php 7.2. (Please only use uptil Xdebug 2.6, because later versions had some issues with debugging).
So if you had any other version installed like php 7.3 or 7.4 then oyu had to also install php 7.2 along side your current php version (mostly because now by default latest version is installed through apt). and then update in between alternatives.
To set PHP 7.0 as the default, run
To set PHP 7.2 as the default, run
To set PHP 7.3 as the default, run
To set PHP 7.4 as the default, run
Before we can configure Apache to use PHP 7.2, we need to disable the new (or old) version of PHP by typing
Now enable the newly installed PHP 7.2 version with the following command:
Restart the Apache web server for the changes to take effect: