How to setup Docker + PhpStorm + xdebug on Ubuntu 16.04

后端 未结 2 2100
别跟我提以往
别跟我提以往 2020-12-01 17:24

My problem is that xdebug doesn\'t work when I start listening port. I think PhpStorm can\'t link with xdebug. I just get debugger panel variables are not available. It\'s l

相关标签:
2条回答
  • 2020-12-01 17:39

    Docker on Linux allows Xdebug to automatically connect back to the host system so you can just set xdebug.remote_connect_back=1 and leave out the xdebug.remote_host in your xdebug.ini.

    0 讨论(0)
  • 2020-12-01 18:04

    I found out solution how to run xdebug.

    1) First of we need create a new static route that will based on your network device. For create new static route: run in terminal ifconfig

    and found out the exists network device. In my situation name of device will be as

    wlp4s0

    2) Go ahead. Let's begin create the static route. In terminal run command like this:

    > sudo ip addr add 10.254.254.254/24 brd + dev wlp4s0 label wlp4s0:1
    

    3) Now if you run again ifconfig you'll see new static route:

    4) Update

    xdebug.ini
    

    file add:

    xdebug.remote_host=10.254.254.254
    

    5) Update docker.compose.yml file: in php section add:

    environment:
        PHP_IDE_CONFIG: "serverName=project-docker"
        PHP_XDEBUG_ENABLED: 1
        XDEBUG_CONFIG: remote_host=10.254.254.254
    

    6) The last thing is update phpstorm settings.

    Server settings: Remote debug config: 7) And profit xdebug is working:

    0 讨论(0)
提交回复
热议问题