使用Netbeans和XDebug进行远程PHP调试 [英] Remote PHP Debugging with Netbeans and XDebug

查看:149
本文介绍了使用Netbeans和XDebug进行远程PHP调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以下情况下尝试使用XDebug。

I'm trying to use XDebug in the following scenario


  • Windows 7上的物理主机,Netbeans 7.1.1

  • Ubuntu上的虚拟客户端,Apache服务器和PHP 5.3.10

  • 我的网站的PHP代码位于Ubuntu上的共享文件夹中,位于/ var / www / mysite

  • PHP代码可以从我的Windows主机访问,在\\\guestIP\mysite上,具有R / W权限

  • 网站可从 http://mysite.local.fr 访问,来自主持人和访客

  • Physical Host on Windows 7, with Netbeans 7.1.1
  • Virtual guest on Ubuntu, with Apache server and PHP 5.3.10
  • the PHP code of my website is on a shared folder on Ubuntu, in /var/www/mysite
  • the PHP code is accessible from my Windows host, on \\guestIP\mysite, with R/W permissions
  • Website accessible from http://mysite.local.fr, from both host and guest

我从Windows主机创建了一个Netbeans项目,指向\\\guestIP\mysite。
在项目运行配置中,我有以下内容:

I created a Netbeans project from my Windows Host, pointing to \\guestIP\mysite. In the project Run configuration, I have the following:


  • 运行方式:本地Web服务器

  • 项目网址: http://mysite.local.fr

  • 索引文件: index.php(确实存在于项目中)

在高级运行配置中:


  • 我选中了每次询问(我也尝试使用不要问,并使用会话密钥自动启动浏览器)

  • 我尝试为映射设置'/ var / www / mysite' - \\GuestIP\mysite(并尝试使用任何内容)

  • 我没有触及代理设置

我在Ubuntu VM上的php.ini中有以下内容

I have the following in the php.ini on my Ubuntu VM

xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = /tmp
;xdebug.remote_host=localhost,<HostIP>, mysite.local.fr
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.idekey="netbeans-xdebug"
xdebug.remote_mode=req

这些都不起作用,Netbeans不会在Windows的任何断点停止。

None of this works, Netbeans does not stop at any breakpoint from Windows.

直接从我的VM与Netbeans调试工作正常。

有人可以告诉我如何获取我的调试器从Windows远程工作?
谢谢

Can someone tell me how to get my debugger to work remotely from Windows? Thanks

推荐答案

对不起,我不能再评论。 @David @ JamesB41:我一直在寻找这个。我的设置是一个Windows 7主机与NetBeans 7.1和Ubuntu VM在VirtualBox。我将NetBeans项目设置为远程项目,使用SFTP上传和下载。

Sorry, i can't comment anymore. @David @JamesB41: I've been looking for this too. My setup is a Windows 7 host with NetBeans 7.1, and an Ubuntu VM in VirtualBox. I have the NetBeans project set up as a remote project, uploading and downloading using SFTP.

以下设置适用于我,只需将主机的IP设置为remote_host,并使确保虚拟机可以看到它。

The following setup works for me, just use your host's IP as remote_host, and make sure the VM can see it.

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=10.217.165.193
xdebug.remote_port=9000
xdebug.remote_log="/tmp/log/xdebug.log"

NetBeans将在入口点断点处停止(如果您在PHP-> Debugging中设置了该选项)。 但是,NetBeans创建的断点不会停止,因为它运行的是VM的文件。您可以使用xdebug_break(),它将显示堆栈和变量。它将在NetBeans断点处停止,并突出显示如果您正在项目配置>运行配置>高级中映射文件夹。真棒我完成了

NetBeans will stop at the entry point breakpoint (if you have the option set in PHP->Debugging). But, it won't stop on NetBeans-created breakpoints, because its running off the VM's files. You can use xdebug_break() though, and it will show stack and variables. It will stop at NetBeans breakpoints and highlight if you map the folders correctly in project config > Run Config > Advanced. Awesome. I am complete.

connect_back config似乎没有帮助,可能是因为$ _SERVER ['REMOTE_ADDR ']没有填充。)

(The connect_back config didn't seem to help, possibly because $_SERVER['REMOTE_ADDR'] isn't populated.)

这篇关于使用Netbeans和XDebug进行远程PHP调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆