Mac ,phpstorm下xdebug擴充套件安裝
安裝xdebug
curl https://xdebug.org/files/xdebug-2.6.0.tgz -O xdebug-2.6.0.tgz
如果上面的命令執行失敗可用,以下括號內命令執行
(
sudo wget https://www.xdebug.org/files/xdebug-2.6.0.tgz -O xdebug-2.6.0.tgz
或者
wget https://xdebug.org/files/xdebug-2.6.0.tgz;
)
解押檔案
tar zxvf xdebug-2.6.0.tgz
cd xdebug-2.6.0
然後處理初始化phpize,不執行phpize ,make可能會執行失敗
/usr/local/php5-5.6.36-20180703-123509/bin/phpize
例如:
./configure --with-php-config=有效php-config地址 --enable-xdebug
例如:
檢視php-config
whereis php-config
which php :這個是檢視正在執行的 ,如果php不對,後面的安裝也不對
(不需要管我使用的是哪個版本的xdebug,因為之前的版本不合適)
使用正常執行的PHP
./configure --enable-xdebug --with-php-config=/usr/local/php5-5.6.36-20180703-123509/bin/php-config
如果執行上面的語句報錯
configure: error: Cannot find PHP-config. Please use --with-php-config=PATH
但實際路徑存在,可以把xdebug解除安裝了,重新安裝或者路徑錯誤。
如果出現下面這句,這說明版本不對,需要重新下載xdebug,並滿足PHP的版本
checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.6.36)
執行完後
make
sudo make install
配置php.ini
消除影響json 輸出的
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
在php.ini中加入xdebug配置
[xdebug]
;zend_extension="剛剛的xdebug路徑/xdebug.so" 在install make後的輸出程式碼中可找到此路徑
zend_extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.idekey = PHPSTORM
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_connect_back = 1
;預設的9000已經被php-fpm佔用了,切記換一個埠
xdebug.remote_port = 9002
xdebug.scream = 0
xdebug.show_local_vars = 1
zend_extension:
重啟一下php-fpm和nginx,看一下php是不是都正常跑起來了.
在php專案中地址中訪問 i.php檔案,檢視xdebug是否配置成功,如果沒有則說明配置失敗。
i.php檔案沒有可檢視:https://mp.csdn.net/postedit/81112321
配置phpstorm
phpstorm -》perferences -》languages&frameworks -》 PHP -》debug
project files 與service的地址應相同
以上資訊配置完成後,可驗證是否配置成功
啟動phpstorm的除錯debug
啟動成功後,打斷點,訪問專案,看是否除錯成功。