概要
m1のmacbook airでpecl install xdebug
が失敗していたので、解決方法をメモします。
xdebugのVersionはxdebug-3.3.2
です。
エラーの内容
MacBook-Air ~ % sudo pecl install xdebug ~省略~ Build process completed successfully Installing '/opt/homebrew/Cellar/php/8.3.6/pecl/20230831/xdebug.so' Warning: mkdir(): File exists in System.php on line 294 PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.3.6/share/php/pear/System.php on line 294 Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.3.6/share/php/pear/System.php on line 294 ERROR: failed to mkdir /opt/homebrew/Cellar/php/8.3.6/pecl/20230831
解決策
phpのバージョンはご自身のものに書き換えてください
MacBook-Air ~ % rm /opt/homebrew/Cellar/php/8.3.6/pecl
MacBook-Air ~ % sudo arch -arm64 pecl install xdebug ~省略~ Build process completed successfully Installing '/opt/homebrew/Cellar/php/8.3.6/pecl/20230831/xdebug.so' install ok: channel://pecl.php.net/xdebug-3.3.2 Extension xdebug enabled in php.ini
php.ini
インストールに成功したらphp.ini
に以下の設定を足します
zend_extension="/opt/homebrew/Cellar/php/8.3.6/pecl/20230831/xdebug.so" xdebug.mode = debug xdebug.start_with_request = yes xdebug.client_port = 9003
最後に確認して以下が出力されたらOKです
MacBook-Air ~ % php --version PHP 8.3.6 (cli) (built: Apr 10 2024 14:21:20) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.6, Copyright (c) Zend Technologies with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies