doubo9799 2012-03-22 07:42
浏览 91
已采纳

使用Netbeans和XDebug进行远程PHP调试

I'm trying to use XDebug in the following scenario

  • 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

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

  • Run as: Local web server
  • Project URL: http://mysite.local.fr
  • Index file: index.php (does exist in the project)

In the Advanced Run Configuration:

  • I checked "Ask every time" (I also tried using "Do not ask" and starting the browser with the session key myself)
  • I tried setting '/var/www/mysite' - \\GuestIP\mysite for the mapping (and tried using nothing as well)
  • I haven't touched the proxy settings

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

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

Debugging directly from my VM with Netbeans works fine.

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

  • 写回答

6条回答 默认 最新

  • dtvgo28624 2012-05-16 15:45
    关注

    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.

    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 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.

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵