Docker desktop与PHPSTORM整合

设置Docker Desktop

Settings -> General -> Expose daemon on tcp://localhost:2375 without TLS(勾选并重启)

设置xdebug

xdebug.idekey=PHPSTORM
xdebug.remote_host=host.docker.internal
xdebug.remote_enable=on
xdebug.remote_port = 9001
xdebug.remote_handler = dbgp
xdebug.auto_trace = 1
xdebug.remote_log = /tmp/xdebug.log

设置PHP STORM

重启PHP STORM

设置

File -> Settings -> Build, Execution, Development -> Docker -> TCP Socket(没有的可以手动添加一个) -> Engine API URL(填写上tcp://localhost:2375)

CLI interpreter

File -> Settings -> Language & Framework -> PHP -> CLI interpreter(设置成对应的容器)

PHP Storm设置Debug端口

File -> Settings -> Languages & Frameworks -> PHP -> Debug -> Xdebug -> Xdebug Port(Debug的端口,设置为和xdebug.remote_port一样的值)

PHP Storm设置DBGp Proxy

File -> Settings -> Languages & Frameworks -> PHP -> Debug -> DBGp Proxy
IDE key : 服务器开启调试的Key,设置成和xdebug.idekey一样
Host : 服务器的IP,设置成127.0.0.1
Port : Debug的端口,设置为和xdebug.remote_port一样的值

PHP Storm设置Servers

File -> Settings -> Languages & Frameworks -> PHP -> Servers
Name : 随便填
Host : 填网站的域名
Port : 填网站的端口
Debugger : 选择Xdebug

配置项目Debug信息

Run/Debug Configurations
Server : 选择上一步添加的Server

标签: docker, phpstorm

添加新评论