Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug VM with xDebug and PhpStorm

My work setup is a Windows XP host, running an Ubuntu VM LAMP stack. I am using PhpStorm to edit my code on my host Windows machine. Upon saving files are automatically uploaded to the VM via SFTP. Everything works for this process, except debugging.

I have setup PhpStorm to have a server named "UbuntuVM" with the following settings:

Debugger:
- XDebug
Debug session settings:
- Break at the first line
- Wait for connection with ide key: XDEBUG_PHPSTORM
Before launch:
- Upload files to selected server

I am using Chrome with Xdebug Helper, and have set the extension to use "Other" as the IDE, with "XDEBUG_PHPSTORM" as the key.

The VM has the following in the php.ini:

zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=10.1.6.22
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.collect_params=On
xdebug.show_local_vars=On

When I set a break point in my IDE, enable the debugger in Chrome, and reload the page, I never hit the break point; and the IDE says "Waiting for connection on port 9000 with ide key 'XDEBUG_PHPSTORM'".

Does anyone have any idea why I'm not hitting my break points?

like image 542
Andrew Ellis Avatar asked Nov 23 '10 21:11

Andrew Ellis


People also ask

How do I debug PhpStorm?

On the PhpStorm toolbar, toggle. to start listening for incoming PHP debug connections, or choose Run | Start Listening for PHP Debug Connections from the main menu. Set a breakpoint in your code. Breakpoints can be set in the PHP context inside PHP, HTML, TWIG, BLADE, and files of other types.

How does PHP Xdebug work?

When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it's running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).


1 Answers

Comes to find out that xdebug.remote_host isn't needed, rather, use xdebug.remote_connect_back=1.

like image 131
Andrew Ellis Avatar answered Sep 27 '22 19:09

Andrew Ellis