laradock xdebug

1、本地自搭环境安装xdebug,版本判断 

>php -i;

拷贝HTML内容至https://xdebug.org/wizard.php,下载合适的xdebug版本;

2、laradock配置的docker环境

1)在.env文件中找到以下变量,并设置为true

WORKSPACE_INSTALL_XDEBUG=true
PHP_FPM_INSTALL_XDEBUG=true

2)重新构建workspace和php-fpm容器

> docker-compose build workspace php-fpm
> docker-compose up -d nginx redis mysql phpmyadmin

 注:重新构建php-fpm时可能遇到以下错误

install failed
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c if [ ${INSTALL_IMAGEMAGICK} = true ]; then     apt-get install -y libmagickwand-dev imagemagick &&     pecl install imagick &&     docker-php-ext-enable imagick ;fi' returned a non-zero code: 1
此时开启VPN重新构建

3、phpstorm配置

1)Preferences | Languages & Frameworks | PHP | Debug,配置如下:

 2)Preferences | Languages & Frameworks | PHP | Debug | DBGp Proxy,配置如下:

3)Preferences | Languages & Frameworks | PHP | Servers,配置如下

4)Run/Debug Configurations,配置如下:

至此,配置结束,Debug模式如下:

4、Debug模式的开启与关闭

#laradock目录下
> ./php-fpm/xdebug stop
> ./php-fpm/xdebug start

猜你喜欢

转载自blog.csdn.net/u012160319/article/details/83007618