Remote PHP Debugging with Netbeans and XDebug

前端 未结 6 801
醉酒成梦
醉酒成梦 2020-12-31 06:35

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 PH
6条回答
  •  爱一瞬间的悲伤
    2020-12-31 07:20

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

提交回复
热议问题