Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No incoming connection for PhpStorm with xdebug (nginx / php-fpm)

Tags:

php

nginx

xdebug

I figured I'd try using nginx instead of Apache and see how that works, and I'm up and running, but I cannot for the sake of my life figure out how to make PhpStorm capture the incoming xdebug connection. It worked perfectly when I was running Apache.

Usually, you'd get an "incoming connection"-window in PhpStorm - this window now shines with its absence - and yes; I've read every single PhpStorm / Xdebug question on StackOverflow and neither has solved my issue.

Configuration: OS: OSX Mavericks PhpStorm version: 7.1 Xdebug version: 2.2.5

Note that I'm running nginx and PHP through php-fpm which is working as expected. I've pointed out the same PHP-file as php-fpm is running to PhpStorm which successfully finds Xdebug as the debugger.

Since php-fpm is running port 9000 just as Xdebug, I've changed this to 9900 and 9001 (tried both) and made sure to check my phpinfo() to see that the server has updated the php.ini config with it and I've checked that I've updated the Xdebug port in PhpStorm. I've also enabled "Start listening for debug connections" in PhpStorm.

Xdebug config from php.ini:

[xdebug]
zend_extension = /usr/local/Cellar/php55/5.5.14/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.auto_trace=0
xdebug.default_enable=1
xdebug.idekey="PHPSTORM"
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir="/tmp"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.remote_port=9001

As mentioned - xdebug is loaded when I load phpinfo() in the browser and I've set the correct port in PhpStorm.

Thanks for your help.

like image 497
Helge Talvik Söderström Avatar asked Nov 11 '22 05:11

Helge Talvik Söderström


1 Answers

I cannot stress enough the importance of one of the remarks - "Don't forget to set the cookie for xdebug". I had everything right and my debugger still wouldn't attach due to this. One recommendation I can make is to install xdebug helper chrome extension. Once you have it, start the debug from PhpStorm, navigate to the page you want to debug and turn on the debug setting in the extension by clicking the "bug" icon within address bar.

like image 87
Vlad Rypacek Avatar answered Nov 15 '22 05:11

Vlad Rypacek