I've created an image with this Dockerfile
FROM php:7.3.28-apache-buster
RUN pecl install xdebug-2.8.1 \
&& docker-php-ext-enable xdebug
COPY . /var/www/html
WORKDIR /usr/src/myapp
then I creted this docker-compose.yml
v
ersion: '3'
services:
app:
container_name: php7.3-xdebug
image: 'php7.3-server'
ports:
- '9090:80'
build:
context: ./
dockerfile: ./dockerfile
volumes:
- ./:/var/www/html
environment:
XDEBUG_CONFIG: remote_host=host.docker.internal remote_port=9000 remote_enable=1
container runs ok and the xdebug extension sis shown on phpinfo()
and this is the launch.json that I'm using
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html": "${workspaceRoot}",
},
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
But when I set a breakpoint the execution doesn't stop
My Answer:
't have a specific function called "php - Xdebug doesn't." However, Xdebug is a popular PHP extension that provides debugging and profiling capabilities for PHP developers. It allows developers to step through their code, set breakpoints, and inspect variables to help identify and fix issues in their code. If you are having trouble with Xdebug, you may want to check your PHP configuration settings or consult the Xdebug documentation for troubleshooting tips.
Rate this post
5 of 5 based on 1576 votesComments