LoginSignup
3
2

More than 3 years have passed since last update.

phpbrew + xdebug環境でのphpstormデバッグの設定

Last updated at Posted at 2018-07-02

前提

  • ローカルPCにphpが入っていること
  • ローカルPCにxdeugが入っていること

確認方法
php -vとかphp -m |grep xdebugとか
PHPStoem側でxdebugが読み込まれていることを確認してください。

画像1
image.png

1. PHPSrorm側で実行するserverの環境を登録します。

language & frameworks -> PHP -> Servers から設定します。

serversのところを選択すると、下のような設定画面が表示されるはずです。
設定項目は以下のように設定してください。

image.png

2. xdebug.iniを編集する

1.xdebug.so の場所を探す。
探し方: find /Users -name 'xdebug.so'

2.出てきたパスをxdebug.iniに設定する
画像1に出てるパスをクリックするとPHPstormからも直接修正できます。

私はこんな感じにしました。
phpstormのデフォルトポートは9000です。

xdebug.ini
zend_extension="/Users/hoge/.phpbrew/php/php-7.0.14/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=127.0.0.1 
xdebug.remote_port=9000
xdebug.remote_log=/tmp/xdebug.log

3.PHPStormでのDebug時に、毎回1行目で止まるのを解除する

下記から解除できます。
Run > Break at first line in PHP scriptsのチェックをOFF

4.php.iniを再読み込みする

5.デバッグをONにして、読み込まれるソースにブレイクポイントをつける

6 ブレイクポイントで止まれば正常に設定されています。

参考

PhpStormでXdebugを使えるようにしよう! - Qiita
PHPStormでのDebug時に、毎回1行目で止まるのを解除する - Qiita

3
2
0

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
3
2