Skip to content

Instantly share code, notes, and snippets.

@celian-m
Created October 25, 2022 14:17
Show Gist options
  • Save celian-m/6213ba162a93c2db9877b20fc3b853c0 to your computer and use it in GitHub Desktop.
Save celian-m/6213ba162a93c2db9877b20fc3b853c0 to your computer and use it in GitHub Desktop.

Create an Alias for your host adress (on your mac)

sudo ifconfig lo0 alias 10.254.254.254

Create a Launch Configuration for VS Code

{
    "name": "Listen for Xdebug",
    "type": "php",
    "request": "launch",
    "port": 9001,
    "pathMappings": {"/var/www/html" : "${workspaceRoot}/wordpress"}
}

Create a php.xdebug.ini file in your project

xdebug.idekey=PHPSTORM
xdebug.mode=debug
xdebug.client_port=9001
xdebug.discover_client_host=1
xdebug.start_with_request=1
xdebug.client_host=10.254.254.254
xdebug.remote_connect_back=0

In Docker-compose, sahre the config file under volumes

volumes:
    - ./config/php.xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini

In your DockerFile enable xdebug

RUN pecl install xdebug && docker-php-ext-enable xdebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment