devilbox/docs/intermediate/configure-php-xdebug/atom.rst
2018-07-26 09:38:54 +02:00

4.1 KiB

orphan

Configure Xdebug for Atom

Table of Contents

local

Prerequisites

Ensure you know how to customize php.ini values for the Devilbox and Xdebug is enabled.

* php_ini * configure_php_xdebug_enable_xdebug

Atom configuration

  1. Install php-debug for Atom

  2. Configure path mapping in config.cson or ui.

    "php-debug":
    {
       ServerPort: 9000
       PathMaps: [
         "remotepath;localpath"
         "/shared/httpd;/home/cytopia/repo/devilbox/data/www"
       ]
    }

    Important

    You need to adjust the path part on the right side, as it will most likely be different on your system.

    Also note that on Windows you have to use \\ as directory separators. E.g.: C:\\Users\\projects.

Xdebug configuration

Xdebug configuration for the Devilbox will slightly vary depending on your host operating system and your Docker version (native or Toolbox). Pick your system below and create correct xdebug.ini for the Devilbox.

Docker on Linux

# Defaults
xdebug.remote_enable=1
xdebug.remote_port=9000

# The Linux way
xdebug.remote_connect_back=1

# idekey value is specific to each editor
# Verify with Atom documentation
xdebug.idekey=xdebug-atom

# Optional: Set to true to auto-start xdebug
xdebug.remote_autostart=false

Docker for Mac

Important

Ensure you have created an howto_host_address_alias_on_mac and 10.254.254.254 is aliased to your localhost.

# Defaults
xdebug.remote_enable=1
xdebug.remote_port=9000

# The MacOS way
xdebug.remote_connect_back=0
xdebug.remote_host=10.254.254.254

# idekey value is specific to each editor
# Verify with Atom documentation
xdebug.idekey=xdebug-atom

# Optional: Set to true to auto-start xdebug
xdebug.remote_autostart=false

Docker for Windows

On Windows you will have to manually gather the IP address and add it to xdebug.remote_host.

  1. Open command line
  2. Enter ipconfig
  3. Look for the IP4 address in DockerNAT (e.g.: 192.168.246.1)

howto_open_terminal_on_win

Important

The below listed xdebug.ini uses 192.168.246.1, you need to change this to whatever IP address came out on your system.

# Defaults
xdebug.remote_enable=1
xdebug.remote_port=9000

# The Windows way
xdebug.remote_connect_back=0
xdebug.remote_host=192.168.246.1

# idekey value is specific to each editor
# Verify with Atom documentation
xdebug.idekey=xdebug-atom

# Optional: Set to true to auto-start xdebug
xdebug.remote_autostart=false

Docker Toolbox

Note

This applies for both, Docker Toolbox on MacOS and Docker Toolbox on Windows.

  1. Forward host os port 9000 (Xdebug listening port of your IDE) to Docker Toolbox machine also on port 9000. (remote or local forward)

    • howto_ssh_port_forward_on_docker_toolbox_from_host
    • howto_ssh_port_forward_on_host_to_docker_toolbox
  2. Add xdebug.php

    # Defaults
    xdebug.remote_enable=1
    xdebug.remote_port=9000
    
    # The Docker Toolbox way
    xdebug.remote_connect_back=0
    xdebug.remote_host=docker.for.lin.host.internal
    
    # idekey value is specific to each editor
    # Verify with Atom documentation
    xdebug.idekey=xdebug-atom
    
    # Optional: Set to true to auto-start xdebug
    xdebug.remote_autostart=false
    • CNAME for connect_to_host_os_docker_on_linux