LoginSignup
30
29

More than 5 years have passed since last update.

You are running composer with xdebug enabled. This has a major impact on runtime performance.対策

Last updated at Posted at 2016-03-08

新しい記事「必要な時にのみxdebugをオン」を投稿しました(2017/05/19)


Composer 1.3.0 - https://github.com/composer/composer/blob/1.3.0/CHANGELOG.md

Fixed ext-xdebug not being require-able anymore due to automatic xdebug disabling
自動で無効化されるようになったので、ユーザー側のワークアラウンドはもはや不要になったようです。

以上はコメント欄で@tadsanさんが教えてくれた内容です。
composerでの対策は不要になりましたが、記事の内容はxdebug あり/なしを実行単位で変える時に有効です。

--

xdebugをインストールしたphpでcomposerを使うとパフォーマンスが悪化し(x3-x4)警告が出ます。

マニュアル Xdebug impact on Composerに載っているようにxdebugの読み込みをコメントアウトします。(iniファイルの場所はphp --iniで分かります)

;zend_extension = "/path/to/my/xdebug.so"

ツールの実行はxdebugなしで、phpunitのテストカバレッジやPhpStormではxdebugありでとPHPの実行を使い分けたくなりますが、切り替えをする方法が簡単ではありません。

そこで環境を切り替えるのではなく、実行時に明示的に指定するようにします。

シェル

~/.bash_profile
alias phpx="php -dzend_extension=xdebug.so"
alias phpunitx="phpx $(which phpunit)"

これでphpx, phpunixがそれぞれxdebug付きで実行されます。テストでカバレッジが取れるようになりxdebugなしのphp, phpunitと使い分けができます。

PhpStorm

Language & Frameworks > ... > Advanced > Configuration optionsでdirectiveにzend_extension、値をxdebug.soと設定するとxdebug付きでPHP実行されるようになります。

スクリーンショット 2016-03-08 11.03.09.png

30
29
6

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
30
29