mac 环境
docker环境 配置
1、安装 docker (略)
2、php nginx 等镜像 使用的是 laradock (HEAD detached at v7.1.2)
3、配置 laradock .env
WORKSPACE_INSTALL_XDEBUG=true
PHP_FPM_INSTALL_XDEBUG=true
4、配置 xdebug.ini (更新 ini 需要重新构建 php-fpm :xdebug.ini 文件是 copy 进入容器而不是挂载。所以需要重新构建镜像)
{laradock_root}/php-fpm/xdebug.ini
;xdebug.remote_host=dockerhost
xdebug.remote_connect_back=0 //允许远程主机连接返回
xdebug.remote_port=9000 //xdebug 端口
xdebug.idekey=PHPSTORM //与 phpstorm 交互的 key
xdebug.remote_host=docker.for.mac.localhost
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.cli_color=0
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
5、构建 php 镜像
docker-compose build php-fpm
6、启动 docker
docker-compose up -d nginx
phpstorm 配置
1、配置 php 环境
- 需要与 php 交互,必须配置 php 的 cli 交互接口。
- 验证是否存在 xdebug 扩展
2、 xdebug 环境检查
3、xdebug 配置
点击 增加 xdebug server 配置
点击下面按钮开始监听
进行断点调试