A Debian image using Apache (prefork), PHP and Xdebug
- Debian 12
- Apache 2.4.61
- PHP 8.2.20
- Xdebug 3.2.0
git clone ...
docker compose up \
--mount type=bind,source=/path/to/php-project,target=/app \
--mount type=bind,source=/path/to/apache-config.conf,target=/etc/apache2/apache2.confBy default Apache is listening on 8000, Xdebug on 9003.
Here's the environment you can play with
ENV APACHE_SERVER_NAME="example.localhost"
ENV APACHE_LISTEN_PORT="*:80"
ENV XDEBUG_CLIENT_PORT="9003"
- https://matthewsetter.com/setup-step-debugging-php-xdebug3-docker/
- https://peterbabic.dev/blog/php-xdebug-in-docker/
Just use socat to listen, should get some spew with XML.
socat tcp-listen:9003 stdout
Your .vscode/launch.json should include a part like this snippet.
The key /var/www/html is the path on the server and it's value is the localpath.
{
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceRoot}/webroot"
}
}
]
}