laradock
配置
编辑
laradock/.env
文件
WORKSPACE_INSTALL_XDEBUG=true
PHP_FPM_INSTALL_XDEBUG=true
从新构建容器
docker-compose build workspace php-fpm
# 启动
docker-compose up -d nginx mysql redis
贴一下
workspace/xdebug.ini
&
php-fpm/xdebug.ini
默认配置,新手不要拷贝网上教程配置,保持默认配置就能够,这里只解释一个参数
xdebug.remote_connect_back=1
表示动态捕获来源
host
,不须要设置
xdebug.remote_host
,若是设置等于 0,则须要指定
xdebug.remote_host
地址
; xdebug.remote_host=dockerhost
; Mac 系统须要设置remote_host
; xdebug.remote_host=docker.for.mac.localhost
; xdebug.remote_host=docker.for.mac.host.internal
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.cli_color=0
xdebug.profiler_enable=0
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
PHPStorm 配置
打开
PHPStorm
,
File -> Settings
进入
Languages & Frameworks -> PHP -> Servers
。新建一个
Servers
,以下图
-
Name
填写内容必须和 laradock/.env
文件 serverName
一致,默认为 laradock
-
Host
为 server
对应的 Host
地址;Port
不用修改;Debugger
选择 Xdebug
- 设置目录映射(
Use path mappings
),本地目录
-> 远程目录
### Remote Interpreter ####################################
# Choose a Remote Interpreter entry matching name. Default is `laradock`
PHP_IDE_CONFIG=serverName=laradock

设置断点,点击电话按钮启动监听就能够进行断点调试了

