php 配置远程调试,PHP Linux 环境下搭建 XDEBUG并配置远程调试
在網(wǎng)站 https://xdebug.org/download.php 找到對應PHP版本的XDEBUG下載,下載時選擇source版本
image
獲取下載地址## 下載打包的源碼
wget https://xdebug.org/files/xdebug-2.5.5.tgz
解包
tar zxvf xdebug-2.5.5.tgz
進入解包后的源碼目錄
cd xdebug-2.5.5
執(zhí)行 phpize 生成配置文件腳本 configure
phpize
查找php-config 的位置
find / -name php-config
執(zhí)行 configure 腳本 --with-php-config=php-config的路徑
./configure --with-php-config=/usr/local/php/bin/php-config
編譯源碼
make
編譯生成PHP的擴展模塊,成功完成后根據(jù)提示( Installing shared extensions: )找到模塊路徑記錄下來后面要用來配置xdebug
make install
image
服務器端安裝完成
配置PHPSTORM 連接上服務器,相當于 ftp
image
image
image
image
image
image
image
配置PHPSTORM XDEBUG端口
image
image
image
image
配置Xdebug 和 Xdebug 與 PHPSTORM 的通信
查看PHP載入的所有配置文件
image
進入PHP會掃描的配置文件夾,添加xdebug的配置,這里要注意可能只是命令行的配置文件,不代表 php-fpm 也會使用這些配置,如果后面沒有在 phpinfo 中看到xdebug, 先重啟 php-fpm 和 nginx,如果還是無效那么要去 php-fpm 讀取的配置中設置 xdebug 的配置
; so 的路徑 make install 成功后有提示,上面講過
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
;遠程IP(公網(wǎng)IP),由于公網(wǎng)IP是動態(tài)的,
;但是沒有路由器權限,又不能做端口映射
;所以這里采用 SSH 隧道的方式轉(zhuǎn)發(fā)
xdebug.remote_host=127.0.0.1
;遠程調(diào)試端口
xdebug.remote_port=9020
;調(diào)試器的關鍵字
xdebug.idekey=PHPSTORM
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_log=/var/log/php/xdebug.log
xdebug.remote_timeout=20000
重啟 php-fpm 和 nginx
systemctl restart php-fpm
systemctl restart nginx
建立后臺運行的SSH隧道
ssh -f -N -R 192.168.1.197:9020:127.0.0.1:9020 root@110.110.110.128
完成。。。。
XDEBUG 調(diào)試示例
image
image
image
總結(jié)
以上是生活随笔為你收集整理的php 配置远程调试,PHP Linux 环境下搭建 XDEBUG并配置远程调试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 奇函数乘以奇函数是不是等于偶函数 奇函数
- 下一篇: qq屏蔽好友怎么解除