mac環境已經默認安裝了phpphp
brew支持如下版本的phpapache
homebrew/php/php53-xdebug homebrew/php/php55-xdebug homebrew/php/php70-xdebug homebrew/php/xdebug-osx homebrew/php/php54-xdebug homebrew/php/php56-xdebug homebrew/php/php71-xdebug
選擇一個版本,如如下命令:瀏覽器
接着會有一大段日誌輸出,不要緊,結果以下:bash
到以上日誌指定的路徑下找到:ext-xdebug.ini這個文件,並打開,內容以下:php7
[xdebug] zend_extension="/usr/local/opt/php55-xdebug/xdebug.so"
拷貝以上路徑。測試
打開php配置文件:php.ini,mac環境下,此文件在 /etc/php.ini,加入如下內容:spa
sudo apachectl restart
測試文件:debug
<?php echo phpinfo(); ?>
放到Apache服務目錄下,默認的應該是:/Libiary/WebServer/Decuments/,在瀏覽器訪問:rest
http://localhost/info.php,在打開的頁面中搜索:xdebug。有內容輸出表示安裝成功。日誌