sanamaz 2019-06-28
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,File -> Settings进入Languages & Frameworks -> PHP -> Servers。新建一个Servers,如下图
Name 填写内容必须和 laradock/.env 文件 serverName 一致,默认为 laradockhost 为 server 对应的 host 地址;Port 不用修改;Debugger 选择 XdebugUse path mappings),本地目录 -> 远程目录### Remote Interpreter #################################### # Choose a Remote Interpreter entry matching name. Default is `laradock` PHP_IDE_CONFIG=serverName=laradock

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

