Source: peterbabic.dev

PHP xDebug in Docker
This is a trashpost mostly used to store all the links I had in my tab. There might me incomplete, missing or conflicting information below so take this with a grain of salt. Whatever you Dockerfile contents are, add these somewhere sensible, before EXPOSE or COPY usually: RUN apk add --no-cache $PHPIZE_DEPS linux-headers && \ pecl install xdebug && docker-php-ext-enable xdebug docker-compose.yml

Note the.ini files in volumes: version: "3.9" services: app: build: context:./ dockerfile: Dockerfile image: php-fpm-81 container_name: my-app restart: unless-stopped tty: true working_dir: /var/www volumes: -./:/var/www -./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini error_reporting.ini

Using off-the-shelf vscode for an occasional debug is currently enough: {"version": "0.2.0", "configurations": [{ "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003, "pathMappings": {"/var/www/": "${workspaceFolder}"} }] }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners