栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

php-xdebug调试

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

php-xdebug调试

phpstorm设置
  • 设置port : setting->PHP->DEBUG,填写debug port
  • add server : configurations -> PHP Web Page -> 设置路径映射
php.ini配置 xdebug2
xdebug.remote_enable = On
xdebug.remote_handler= "dbgp"
;启用性能检测分析
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = profiler.out.%t.%p
;启用代码自动跟踪
xdebug.auto_trace = On
 
;指定性能分析文件的存放目录
xdebug.profiler_output_dir = "某盘:xxxphpxdebug"
;指定启用代码自动跟踪文件的存放目录
xdebug.trace_output_dir = "某盘:xxxphpxdebug"
xdebug.remote_log = "某盘:xxxphpxdebugremote.log"
xdebug.show_local_vars = 0
 
;配置xdebug监听的端口  端口随意改 推荐大于9000 且该端口不需要映射到宿主机,xdebug自己默认暴露但不映射
xdebug.remote_port = 9001
xdebug.idekey = "phpstorm"
# docker推荐采用如下形式表示和phpstorm所在机器的ip(如果你的phpstorm装在宿主机那就是宿主机的ip)
xdebug.remote_host = host.docker.internal
xdebug3

xdebug3版本的参数都有所改变的

[xdebug]
zend_extension=""
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=""

phpstorm文档:https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html#updatingPhpIni

cli/服务端配置
# serverName是IDE Setting -> PHP -> SERVER -> 第一个server的name
export PHP_IDE_CONFIG="serverName=ceportal.local.xiaoe.com"

# 注册cookie,idekey是php_xdebug的配置
export XDEBUG_CONFIG="idekey=qqq"

export PATH=${PATJ}:/home/work/bash

export APP_ENV="local"

alias ll='ls -al'
xdebug原理
  • phpstorm监听端口N
  • 客户端通过80端口走到nginx
  • 服务端nginx转发给9000端口的php-fpm。
  • php跟客户端的端口N进行通信,并且返回http的response

小工具 tcpdump -i 网卡名 ‘port N’ 查看tcp连接

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/964282.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号