LoginSignup
0
2

More than 3 years have passed since last update.

MacのPHP(Homebrew)でxdebug環境を用意する

Last updated at Posted at 2019-07-16

Macローカルでデバッグがしたい

Dockerで立てる程ではないものの確認を行いたい場合にいいと思ったので。
PHPのバージョンが同じであれば、Dockerコンテナでも同じ設定で行けそうです。
Windowsはこちら

前提条件

console
% php -v
PHP 7.3.6 (cli) (built: Jun 17 2019 08:40:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies

インストール

peclからインストールします。

console
% pecl install xdebug
# --- 中略 ---

# エラーが出る場合
% pecl search xdebug                                                                                                          [master]
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest)    Local
xdebug  2.8.0alpha1 (beta) 2.8.0alpha1 Provides functions for function traces and profiling

% pecl install -f xdebug-2.8.0alpha1

# 確認
% php -v
PHP 7.3.6 (cli) (built: Jun 17 2019 08:40:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.8.0alpha1, Copyright (c) 2002-2019, by Derick Rethans
    with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies

おまけ: php.iniの場所

console
% php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/etc/php/7.3
Loaded Configuration File => /usr/local/etc/php/7.3/php.ini

あとは、PhpStormなどで設定するだけ。

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