LoginSignup
4

More than 3 years have passed since last update.

PHPStormでステップ実行(Docker For Mac(Windows)環境)

Last updated at Posted at 2018-03-20

Docker For Mac(Windows)環境でPHPStormでステップ実行

↓の記事の補足になります。
参考:PHPStormでステップ実行(Docker Toolbox環境)
https://qiita.com/yKanazawa/items/0655db2a14b842f80e03

Docker Toolbox環境の場合は、PHP Stormに対するIPアドレスがデフォルトで192.168.99.100になりますが、Docker For Mac(windows)では127.0.0.1になってしまうため、コンテナ内から9000番ポートでアクセスできません。

ホストPCのIPアドレスを指定すれば通信できるのですが、大抵のPC環境では、DHCPで動的にIPアドレスが割り振られているでしょうから、毎回設定する必要があり、不便です。

この場合、以下のように設定すれば毎回設定しなくても通信できるようになります。

[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = On
xdebug.remote_port = 9000
;xdebug.remote_autostart = On
xdebug.remote_host = host.docker.internal
xdebug.profiler_output_dir = "/tmp"
xdebug.max_nesting_level= 1000
xdebug.idekey = "PHPSTORM"

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
  3. You can use dark theme
What you can do with signing up
4