Search code examples
phpxdebugphpstorm

No incomming connection from XDebug on Ubuntu VirtualMachine to PhpStorm on Windows host


I have a Win7 on my laptop and a VMware Machine running Ubuntu.

On the last one I have my LAMP configured and also a samba server in order to be able to share my projects to Win7 (mapping a drive).

I just installed xdebug through a package manager and done the following configuration in the php.ini:

extension=xdebug.so
[xdebug]
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_host=192.168.199.2 # this is my $_SERVER['REMOTE_ADDR']
xdebug.remote_port=9055
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0

Then I got through the following checklist:

  • confirm xdebug is installed using phpinfo()
  • got some marklets from here so I can easily send xdebug cookie
  • in PHPStorm->Settings->PHP->Debug I have set the 9055 port for xdebug
  • pressed the "phone icon" in PHPStorm in order to listen for incoming xdebug connection, and set debug key (same as the one sent by markets - 'xdebug')
  • moved to browser, accessed my script url, start a debug session using marklet (confirmed afterwords the presence of debug key in phpinfo())
  • marked a break point in my script
  • refreshed browser page

But nothing works for me.


Solution

  • Briefly, the fix for my problem was this:

    • enable xdebug.remote_log (where I could check for connection attempts and identify the exact IP to which xdebug was trying to connect) - [this was the key]
    • removed/set to 0 xdebug.remote_connect_back (because it overwrites remote_host with $_SERVER['REMOTE_ADDR'])
    • set the proper xdebug.remote_host
    • removed extension=xdebug.so an loaded xdebug using only zend_extension

    So, every time, do not forget to check the logs if exists! :)

    Thanks to LazyOne for very helpful hints!