I’m trying to use XDebug in the following scenario
- my computer Windows 7, Netbeans 6.9
- Physical Host at computer on the same network (Windows 7) with virtual Box
- Virtual CentOS 6.2, with Apache server 2.2.15 and PHP 5.3.3
- the PHP code of my website is on a shared folder on CentOS, in /var/www/html/mysite and have separate and can access it by server ip
- Edited C:\Windows\System32\drivers\etc\hosts
- the PHP code is accessible from my Windows host, on
\\HostIP\html\mysite, with R/W permissions
I created a Netbeans project on my computer, pointing to
\\HostIP\html\mysite. In the project Run configuration, I have the following:
- Run as: Remote Web Site
- Project URL:
- Index file: index.php (does exist in the project)
In the Advanced Run Configuration:
- I checked “Default”
- I haven’t touched the proxy settings
I have the following in the php.ini on my CentOS VM
;extension=xdebug.so zend_extension="/usr/lib64/php/modules/xdebug.so" xdebug.remote_enable=on xdebug.remote_log="/var/log/xdebug.log" ;xdebug.remote_host=192.168.1.31 xdebug.remote_connect_back=1 xdebug.remote_handler=dbgp xdebug.remote_port=9000
note: I tried the configurations with
extension=xdebug.so and tried commenting
xdebug.remote_connect_back=1 with uncomment
xdebug.remote_host=192.168.1.31 which is my computer ip address.
so basically i have all the configurations like this image
but still not working! after run the debugger will open this url
and nothing will happened just netbeans Listing waiting for Xdebug connection
When i want to debug on a remote host i normally have to forward my local 9000 port to the remote server’s local 9000 via a ssh tunnel:
ssh -R 9000:localhost:9000 [email protected]
Use bitvise ssh client or putty on windows to get the same effect.
Also in the project settings -> run configuration -> Advanced button
make sure to specify the remote and local full paths the the project files so the debugger can attach (don’t worry about the port in this screen leave as standard).
I know this is an old post, but it seemed like the one I ran across the most tonight.
The NAT Network setup is the way to get the least amount of conflict. In the Windows 7 Firewall, setup a custom Inbound Rule to allow inbound traffic to port 9000 for the entire /24 network that the VM is on (192.168.202/24).
My working XDebug setup in the php.ini, using 2.2.7 with Netbeans 8.0.2:
zend_extension=xdebug.so xdebug.remote_enable=1 xdebug.remote_connect_back=1 xdebug.remote_port=9000 xdebug.idekey="netbeans-xdebug" xdebug.show_local_vars=0 ;xdebug.extended_info=1 xdebug.output_buffering=off xdebug.remote_log=/var/log/xdebug.log
Lastly, I want to point out that Netbeans listens for the remote address setup in the remote file config. Doing a quick netstat -an showed that Netbeans was listening on port 9000, with a CLOSE_WAIT status on an old address from my initial bridged network setup. Even after changing the Project URL, and the Remote Connection IP address, and closing several xdebug connections, this never changed. Only after closing Netbeans, does the stale connection drop. Once Netbeans is started again, the new remote server URL is used for the remote xdebug connection.
Mention of Netbeans holding a stale state was never discussed, and the ability to stop the xdebug connection from the IDE gives a false sense of resetting the socket.
If it still doesn’t work, use the provided debugclient on the VM, visit the project page with “?XDEBUG_SESSION_START=netbeans-xdebug” appended to the index.php URL, and watch for the xdebug info to come in. At least then you know it works locally.
Try setting up any breakpoint to your executed script. Debug session may not show up while ide does not respect “break at first line” flag.
Also check if xdebug.idekey property in php.ini equals to ideKey in Netbeans’ settings.