10
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PhpStormでLaravelをリモートデバッグ

Last updated at Posted at 2017-03-20

こちらの記事を参考にしました

ローカルにxdebugをインストールする

php -v で確認

$ php -v
PHP 7.1.2 (cli) (built: Feb 17 2017 10:51:21) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

入ってない。
homebrewでインストール。
php7.1なので php71-xdebug

brew install php71-xdebug

確認

$ php -v
PHP 7.1.2 (cli) (built: Feb 17 2017 10:51:21) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans

OK。

リモート(vagrant)のxdebugの設定をする

今回はHomesteadを使ってるので、デフォルトでxdebugはある程度設定されている。

$ vagrant ssh
$ sudo vim /etc/php/7.1/mods-available/xdebug.ini

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512
xdebug.idekey = "vagrant" ←これを追記。

PhpStormの設定

ここ参考
動画だとPHPのServerのポートを8000に変更してるけど、私は8000をポートフォワードしてなかったので、vagrantのnginxの80ポートを指定しました。
スクリーンショット 2017-03-20 16.47.19.png

試してみる

適当にブレークポイントおいて、Run>Debug>設定したサーバー。

スクリーンショット 2017-03-20 16.53.41.png

できた。

10
19
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
10
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?