Mac的laradock配置xdebug

6 篇文章 1 订阅

一.首先吐槽下,看过网上教程好几个,按照教程配置,怎么也不成功,后来发现是本地的9000端口被php-fpm占用了,解决掉终于OK了。

二.配置步骤如下:

1.laradock目录下的.env   

WORKSPACE_INSTALL_XDEBUG=true

PHP_FPM_INSTALL_XDEBUG=true

2.修改Laradock/PHP-FPM/xdebug.ini 

; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)

  xdebug.remote_host=docker.for.mac.localhost
  xdebug.remote_connect_back=0
  xdebug.remote_port=9000
  xdebug.idekey=PHPSTORM

  xdebug.remote_autostart=1
  xdebug.remote_enable=1
  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

3.重新 build 容器

docker-compose build workspace php-fpm

4.重启容器

docker-compose down && docker-compose up -d nginx mysql redis 

5.PHPStorm 设置:Preferences->Language & Frameworks->PHP->Servers,新建一个 server,这里取名 laradocker。

6.Host 里面填入 laradock。这是因为laradoc/.env 文件里面有一行设置了 serverName。

### Remote Interpreter ####################################

# Choose a Remote Interpreter entry matching name. Default is `laradock`

PHP_IDE_CONFIG=serverName=laradock

7.配置 Run->Edit Configuration

8.工具栏的Run下配置

9.开启调试 完成配置

三.总结

1.网上教程说:在 laradock 目录下面执行 ./php-fpm/xdebug start 开启  这个不开启也不影响使用。

laradocker目录下的workspace/xdebug.ini可不配置,

2.开启debug报错如下

原因是本地php-fpm也占用了9000端口

卸载了本地的php-fpm,就OK了

2.另外开启debug时一直报如图的错误,不知什么原因,也没搞明白

3.最后感慨下,花费我几个小时,入坑挺折腾的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值