LoginSignup
5

More than 5 years have passed since last update.

posted at

PhpStorm + Xdebugでリモートデバッグ時にデバッグクライアントに繋がらない。

事象

PhpStorm + Xdebug でリモートデバッグを行なおうとしたがデバッグクライアントに繋がらない。
リモートデバッグとは言いつつも apache はローカル環境で起動してます。

I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Checking header 'REMOTE_ADDR'.
I: Remote address found, connecting to ::1:9001.
E: Could not connect to client. :-(

原因

xdebug.remote_host に localhost や 127.0.0.1 してても ipv6のループバックアドレス(::1)に変換されて接続しに行って拒否られているようだ。

解決方法

php.ini の xdebug セクションに

xdebug.remote_connect_back=0

または

xdebug.remote_connect_back=off

を設定する。
これで繋がった。

もしかしたら hosts に

localhost 127.0.0.1

て書いても行けるかも。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
5