Connection between phpstorm and xdebug

I configured phpstorm-xdebug and I was able to debug my code with breakpoints. These days I have updated php (via brew) and xdebug and now I have php 5.5.26 with xdebug 2.3.3. When I try to debug tests (and code) phpstorm tells me "no connection to xdebug has been established".

I have already checked the xdebug config in php.ini and it is as follows

[xdebug]
zend_extension="/usr/local/opt/php55-xdebug/xdebug.so"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_port=9000
xdebug.remote_host=127.0.0.1
xdebug.idekey=PHPSTORM

      

and the webserver debug check says

enter image description here

I tried with different versions of phpstorm, uninstalling e reinstalling php55 / php55-xdebug but no success.

Do you have any ideas on how to solve the problem?

+3


source to share


2 answers


After installing new PHP, if you run php-fpm without configuring it correctly, it will listen on port 9000 by default. Here is the "php-fpm.conf" from the distribution you need to change:

/usr/local/etc/php/5.5/php-fpm.conf

...

;   '[::]:port'            - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

      

It binds port 9000, changes it to a different value (in my case, it changed it to 8001). Then tweak your apache configuration accordingly. Here is my config example config (apache 2.4) binding to port 8001



/usr/local/etc/apache2/2.4/extra/proxy-fcgi.conf

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:8001/usr/local/var/www/htdocs/$1
DirectoryIndex /index.php

      

restart apache and php-fpm and you can use port 9000 for xdebug. Start PhpStorm.

+1


source


Another way to solve this problem is to change the xdebug port in php.ini. For example, before 9001:

xdebug.remote_port=9001



After that, you need to change the xdebug port in PhpStorm under Preferences-> Languages ​​and Frameworks -> PHP -> Debug. The Xdebug port is set to 9001.

+3


source







All Articles