Now we need a debug adapter between VS Code and Xdebug. Install an Extension (PHP Debug Adapter) in VS Code add-host=:host-gatewayĪlternatively we can do so using docker-compose and extra_hosts. This won’t work automatically, we need to provide the following run flag: 1 We need to make sure our container can communicate with the host via. You might need to restart your webserver to reload the settings. Notice that we are enabling Xdebug with docker-php-ext-enable. error_reporting.ini /usr/local/etc/php/conf.d/error_reporting.ini xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.iniĬOPY. Install and enable XdebugĬreate or update your Dockerfile to install Xdebug and copy over the files created above.ĭepending on your image, you might need to change how you install Xdebug.ĬOPY. We will also copy this into Docker’s /usr/local/etc/php/conf.d. Error reporting configĬreate a error reporting config file error_reporting.ini with following content: 1 We will define this host when we run our container. Notice that we are setting as host of our debug client. Configure PHP to use Xdebug and enable remote debuggingĬreate a config file named xdebug.ini that we will copy into Docker’s /usr/local/etc/php/conf.d. We need install and set it up inside our Docker container so that it can connect to a debug client running on the host machine. Xdebug is a PHP extension that needs to be installed on your container. So where is how I ended up doing it, hope it helps someone! Setup your container Working on a pet project, I used Docker to do the heavy lifting of setting up a development environment for me.īut I struggled to find a good resource on how to setup up step by step debugging.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |