借鑑文章:
https://www.cnblogs.com/chenhaoyu/p/10999209.html
https://www.cnblogs.com/skyli665/p/9765926.html
https://www.cnblogs.com/coolworld/p/5288220.html
一:下載對於版本xdebug
官網:https://xdebug.org/wizard
命令:wget http://xdebug.org/files/xdebug-2.7.2.tgz (對應版本)
注意:如果不知道自己下哪個版本,輸入phpinfo的網頁源代碼到下圖框中,會自動幫你選擇
二:安裝配置
1、tar -zxvf xdebug-2.7.2.tgz //解壓源碼
2、cd xdebug-2.7.2 //進入解壓後目錄
3、cp config.m4 /opt/phre/php/bin/ //複製文件至php目錄
4、/opt/phre/php/bin/phpize //運行bin目錄下的phpize
5、 ./configure --enable-xdebug --with-php-config=/opt/phre/php/bin/php-config //預編譯,選擇php-config存放目錄
6、make
7、進入解壓目錄,複製xdebug.so文件至指定目錄 (no-debug-non-zts-20151012/ 你自己的路徑)
cp modules/xdebug.so /opt/phre/php/lib/php/extensions/no-debug-non-zts-20151012/
8、配置php.ini 文件
[Xdebug]
zend_extension ="/opt/phre/php/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so" // so文件路徑
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.2.160 //本機ip
xdebug.remote_port=9000 //未被使用本機端口
xdebug.idekey="PHPSTORM"
9、重啓web服務器 /opt/phre/etc/init.d/php-fpm restart
三:安裝中遇到問題
1.make中文亂碼
https://blog.csdn.net/hpf247/article/details/79981803
2. bash: wget: command not found
https://blog.csdn.net/darkdragonking/article/details/79075343
四:phpstorm 配置
參考文檔
一:查看本機/虛擬機IP
二:配置端口(與php.ini 中相同)
三:配置
四:開啓斷點。必須開啓斷點後,再執行方法!!!