- 设置port : setting->PHP->DEBUG,填写debug port
- add server : configurations -> PHP Web Page -> 设置路径映射
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.internalxdebug3
xdebug3版本的参数都有所改变的
[xdebug] zend_extension="" xdebug.mode=debug xdebug.client_host=127.0.0.1 xdebug.client_port=" "
cli/服务端配置phpstorm文档:https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html#updatingPhpIni
# 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连接



