mac下使用brew安裝php的xdebug擴展

mac環境已經默認安裝了phpphp

一、查看本地的php環境

二、使用brew 命令安裝xdbug

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配置文件:php.ini,mac環境下,此文件在 /etc/php.ini,加入如下內容:spa

五、重啓Apache

sudo apachectl restart

六、測試

測試文件:debug

<?php

echo phpinfo();

?>

放到Apache服務目錄下,默認的應該是:/Libiary/WebServer/Decuments/,在瀏覽器訪問:rest

http://localhost/info.php,在打開的頁面中搜索:xdebug。有內容輸出表示安裝成功。日誌

相關文章
相關標籤/搜索