Remote Debugging with XDebug from inside a Docker Container does not work

后端 未结 4 1530
悲哀的现实
悲哀的现实 2021-02-07 04:31

I\'m trying to setup a dockered AMP environment and can\'t get the remote debugger working. My setup is as follows:

I have a database container running mysql which is wo

4条回答
  •  再見小時候
    2021-02-07 05:17

    You can try with this configuration. php-apache build provide two method to compile and enable module php. It's nicer to use docker-php-ext-enable xdebug to set correct file configuration.

    FROM php:5.4-apache
    
    # Enable and configure xdebug
    RUN pecl install xdebug
    RUN docker-php-ext-enable xdebug
    RUN sed -i '1 a xdebug.remote_autostart=true' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_mode=req' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_handler=dbgp' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_port=9000' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_host=127.0.0.1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    RUN sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    

提交回复
热议问题