Xdebug: [Step Debug] Could not connect to debugging client

后端 未结 3 1312
余生分开走
余生分开走 2021-02-20 17:47

I would like to try Xdebug 3.0.0RC1 to explore what has changed and the new features that come with it. I am also using the latest PhpStorm 2020.3 EAP which supports Xdebug 3 wi

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 18:05

    PHP 7.4
    Docker
    PHPStorm 2020.1
    Xdebug 3.1.0

    Install Xdebug in your docker container using Dockerfile

    RUN pecl install xdebug-3.0.1 && docker-php-ext-enable xdebug
    

    Configure php.ini with following:

    [xdebug]
    xdebug.mode = debug
    xdebug.start_with_request = yes
    xdebug.discover_client_host = 1
    

    Go to PHPStorm - Settings - PHP - Debug - Xdebug and set the port to 9003 (by default)

    PHPStorm

    That's it (:

    If you want to enable/disable debugger only when you need it: just install a browser extension called "Xdebug helper", select "Debug" and remove "xdebug.start_with_request = yes" from php.ini

    [xdebug]
    xdebug.mode = debug
    xdebug.discover_client_host = 1
    

提交回复
热议问题