mirror of
https://github.com/cytopia/devilbox.git
synced 2025-02-21 01:42:14 +00:00
Merge pull request #517 from cytopia/docs-xdebug
Fixes #381 Rewrite and simplify Xdebug documentation
This commit is contained in:
commit
78c76f6b7e
@ -119,6 +119,8 @@ Background
|
||||
they have to be specified.
|
||||
|
||||
|
||||
.. _start_the_devilbox_stop_and_restart:
|
||||
|
||||
Stop and Restart
|
||||
================
|
||||
|
||||
|
@ -27,75 +27,82 @@ how they connect back to the host.
|
||||
Most IDE or editors will also require different configurations for how they talk to PHP Xdebug.
|
||||
This is at least most likely the case for ``xdebug.idekey``.
|
||||
|
||||
.. seealso:: :ref:`configure_php_xdebug_options`
|
||||
|
||||
Configure PHP container for Xdebug
|
||||
==================================
|
||||
|
||||
Configure Xdebug
|
||||
================
|
||||
|
||||
Docker on Linux
|
||||
---------------
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
/intermediate/configure-php-xdebug/php-xdebug-options
|
||||
/intermediate/configure-php-xdebug/xdebug-*
|
||||
|
||||
The following gives you a step-by-step guide on how to setup PHP Xdebug for the Devilbox depending
|
||||
on what host operating system you are using.
|
||||
|
||||
Be reminded that PHP configuration is always done per version, i.e. having it configured for
|
||||
PHP 7.2, does not enable it for any other versions.
|
||||
/intermediate/configure-php-xdebug/linux/*
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
* :ref:`configure_php_xdebug_lin`
|
||||
* :ref:`configure_php_xdebug_mac`
|
||||
* :ref:`configure_php_xdebug_win`
|
||||
* :ref:`configure_php_xdebug_docker_toolbox` (Mac or Windows)
|
||||
|
||||
* :ref:`configure_php_xdebug_lin_atom`
|
||||
* :ref:`configure_php_xdebug_lin_phpstorm`
|
||||
* :ref:`configure_php_xdebug_lin_sublime`
|
||||
* :ref:`configure_php_xdebug_lin_vscode`
|
||||
|
||||
Configure your IDE/editor for Xdebug
|
||||
====================================
|
||||
|
||||
After you have setup PHP Xdebug as referenced above, you can continue to configure your currently
|
||||
used IDE/editor.
|
||||
|
||||
Most IDE/editors will usually be configured in a very similar way, which comes down to two main
|
||||
settings;
|
||||
|
||||
Path mapping
|
||||
------------
|
||||
|
||||
The path mapping is a mapping between the file path on your host operating system and the one
|
||||
inside the PHP Docker container.
|
||||
|
||||
The path on your host operating system is the one you have set in :ref:`env_httpd_datadir`.
|
||||
In case you have set a relative path in ``.env``, ensure to retrieve the absolute path of it when
|
||||
setting up your IDE config.
|
||||
|
||||
The path inside the PHP Docker container is always ``/shared/httpd``.
|
||||
|
||||
.. important::
|
||||
Even though your path in ``.env`` for :ref:`env_httpd_datadir` might be relative (e.g. ``./data/www``),
|
||||
you need to get the actualy absolute path of it, when setting up your IDE.
|
||||
|
||||
IDE key
|
||||
-------
|
||||
This is the value you have set in ``xdebug.ini`` for ``xdebug.idekey``. In the example of this
|
||||
tutorial, the value was set to ``PHPSTORM``.
|
||||
|
||||
Docker on MacOS
|
||||
---------------
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
/intermediate/configure-php-xdebug/editor-*
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
/intermediate/configure-php-xdebug/macos/*
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
* :ref:`configure_php_xdebug_mac_atom`
|
||||
* :ref:`configure_php_xdebug_mac_phpstorm`
|
||||
* :ref:`configure_php_xdebug_mac_sublime`
|
||||
* :ref:`configure_php_xdebug_mac_vscode`
|
||||
|
||||
Docker on Windows
|
||||
-----------------
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
/intermediate/configure-php-xdebug/windows/*
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`configure_php_xdebug_win_atom`
|
||||
* :ref:`configure_php_xdebug_win_phpstorm`
|
||||
* :ref:`configure_php_xdebug_win_sublime`
|
||||
* :ref:`configure_php_xdebug_win_vscode`
|
||||
|
||||
Docker Toolbox
|
||||
--------------
|
||||
|
||||
Docker Toolbox configuration is equal, no matter if it is started on MacOS or Windows, as both
|
||||
use a Linux system inside VirtualBox.
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
/intermediate/configure-php-xdebug/toolbox/*
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`configure_php_xdebug_toolbox_atom`
|
||||
* :ref:`configure_php_xdebug_toolbox_phpstorm`
|
||||
* :ref:`configure_php_xdebug_toolbox_sublime`
|
||||
* :ref:`configure_php_xdebug_toolbox_vscode`
|
||||
|
@ -1,74 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_editor_atom:
|
||||
|
||||
*************************
|
||||
Configure Xdebug for Atom
|
||||
*************************
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure that ``xdebug.idekey`` is set to ``xdebug.atom`` in your PHP Xdebug configuration.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_lin`
|
||||
* :ref:`configure_php_xdebug_mac`
|
||||
* :ref:`configure_php_xdebug_win`
|
||||
* :ref:`configure_php_xdebug_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
**1. Install php-debug for Atom**
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_atom_php_debug|
|
||||
|
||||
**2. Configure path mapping in config.cson or ui**
|
||||
|
||||
.. code-block:: js
|
||||
:caption: config.cson
|
||||
:emphasize-lines: 6
|
||||
|
||||
"php-debug":
|
||||
{
|
||||
ServerPort: 9000
|
||||
PathMaps: [
|
||||
"remotepath;localpath"
|
||||
"/shared/httpd;/home/cytopia/repo/devilbox/data/www"
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
On Windows you have to use ``\\`` as directory separators for the local path mapping.
|
||||
E.g.: ``C:\\Users\\projects``.
|
@ -1,69 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_editor_phpstorm:
|
||||
|
||||
*****************************
|
||||
Configure Xdebug for PhpStorm
|
||||
*****************************
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure that ``xdebug.idekey`` is set to ``PHPSTORM`` in your PHP Xdebug configuration.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_lin`
|
||||
* :ref:`configure_php_xdebug_mac`
|
||||
* :ref:`configure_php_xdebug_win`
|
||||
* :ref:`configure_php_xdebug_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
**1. Ensure Xdebug port is set to 9000**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-settings.rst
|
||||
|
||||
**2. Set path mapping**
|
||||
|
||||
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projects
|
||||
to be in ``./data/www`` of the Devilbox git directory:
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-path-mapping.rst
|
||||
|
||||
.. important::
|
||||
Recall the path mapping!
|
||||
|
||||
**3. Ensure DBGp proxy settings are configured**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-dbgp-proxy.rst
|
@ -1,79 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_editor_sublime3:
|
||||
|
||||
***********************************
|
||||
Configure Xdebug for Sublime Text 3
|
||||
***********************************
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure that ``xdebug.idekey`` is set to ``PHPSTORM`` in your PHP Xdebug configuration.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_lin`
|
||||
* :ref:`configure_php_xdebug_mac`
|
||||
* :ref:`configure_php_xdebug_win`
|
||||
* :ref:`configure_php_xdebug_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
**1. Install Xdebug Client**
|
||||
|
||||
Use Sublime's Package Control to search for and install ``Xdebug Client``.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_sublime_xdebug_client|
|
||||
|
||||
**2. Configure Xdebug.sublime-settings**
|
||||
|
||||
* Navigate to ``Tools`` -> ``Xdebug`` -> ``Settings - User`` in the menu
|
||||
* This will open the configuration file in Sublime
|
||||
|
||||
.. code-block:: json
|
||||
:caption: Xdebug-sublime-settings
|
||||
:emphasize-lines: 3,6
|
||||
|
||||
{
|
||||
"path_mapping": {
|
||||
"/shared/httpd" : "/home/cytopia/repo/devilbox/data/www"
|
||||
},
|
||||
"url": "",
|
||||
"ide_key": "PHPSTORM",
|
||||
"host": "0.0.0.0",
|
||||
"port": 9000
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path mapping!
|
@ -1,86 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_editor_vscode:
|
||||
|
||||
***************************************
|
||||
Configure Xdebug for Visual Studio Code
|
||||
***************************************
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure that ``xdebug.idekey`` is set to ``PHPSTORM`` in your PHP Xdebug configuration.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_lin`
|
||||
* :ref:`configure_php_xdebug_mac`
|
||||
* :ref:`configure_php_xdebug_win`
|
||||
* :ref:`configure_php_xdebug_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
**1. Install vscode-php-debug**
|
||||
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_vscode_php_debug|
|
||||
|
||||
**2. Configure launch.json**
|
||||
|
||||
.. code-block:: json
|
||||
:caption: launch.json
|
||||
:emphasize-lines: 9,10
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Listen for Xbebug",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"serverSourceRoot": "/shared/httpd",
|
||||
"localSourceRoot": "/home/cytopia/repo/devilbox/data/www"
|
||||
}, {
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 9000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path mapping!
|
143
docs/intermediate/configure-php-xdebug/linux/atom.rst
Normal file
143
docs/intermediate/configure-php-xdebug/linux/atom.rst
Normal file
@ -0,0 +1,143 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_lin_atom:
|
||||
|
||||
********************************
|
||||
Docker on Linux: Xdebug for Atom
|
||||
********************************
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install php-debug for Atom
|
||||
--------------------------
|
||||
|
||||
Ensure you have ``php-debug`` installed for Atom.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_atom_php_debug|
|
||||
|
||||
Configure Atom
|
||||
--------------
|
||||
|
||||
You will need to configure the path mapping in ``config.cson`` (Atom configuration file) or via UI:
|
||||
|
||||
.. code-block:: js
|
||||
:caption: config.cson
|
||||
:emphasize-lines: 6
|
||||
|
||||
"php-debug":
|
||||
{
|
||||
ServerPort: 9000
|
||||
PathMaps: [
|
||||
"remotepath;localpath"
|
||||
"/shared/httpd;/home/cytopia/repo/devilbox/data/www"
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,10
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Linux way
|
||||
xdebug.remote_connect_back=1
|
||||
|
||||
; idekey value is specific to Atom
|
||||
xdebug.idekey=xdebug.atom
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
136
docs/intermediate/configure-php-xdebug/linux/phpstorm.rst
Normal file
136
docs/intermediate/configure-php-xdebug/linux/phpstorm.rst
Normal file
@ -0,0 +1,136 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_lin_phpstorm:
|
||||
|
||||
************************************
|
||||
Docker on Linux: Xdebug for PhpStorm
|
||||
************************************
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Configure PhpStorm
|
||||
------------------
|
||||
|
||||
**1. Ensure Xdebug port is set to 9000**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-settings.rst
|
||||
|
||||
**2. Set path mapping**
|
||||
|
||||
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projects
|
||||
to be in ``./data/www`` of the Devilbox git directory:
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-path-mapping.rst
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
**3. Ensure DBGp proxy settings are configured**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-dbgp-proxy.rst
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,10
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Linux way
|
||||
xdebug.remote_connect_back=1
|
||||
|
||||
; idekey value is specific to PhpStorm
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
145
docs/intermediate/configure-php-xdebug/linux/sublime.rst
Normal file
145
docs/intermediate/configure-php-xdebug/linux/sublime.rst
Normal file
@ -0,0 +1,145 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_lin_sublime:
|
||||
|
||||
******************************************
|
||||
Docker on Linux: Xdebug for Sublime Text 3
|
||||
******************************************
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install Xdebug Client for Sublime
|
||||
---------------------------------
|
||||
|
||||
Use Sublime's Package Control to search for and install ``Xdebug Client``.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_sublime_xdebug_client|
|
||||
|
||||
Configure Sublime
|
||||
-----------------
|
||||
|
||||
* Navigate to ``Tools`` -> ``Xdebug`` -> ``Settings - User`` in the menu
|
||||
* This will open the configuration file in Sublime
|
||||
|
||||
.. code-block:: json
|
||||
:caption: Xdebug-sublime-settings
|
||||
:emphasize-lines: 3,6
|
||||
|
||||
{
|
||||
"path_mapping": {
|
||||
"/shared/httpd" : "/home/cytopia/repo/devilbox/data/www"
|
||||
},
|
||||
"url": "",
|
||||
"ide_key": "sublime.xdebug",
|
||||
"host": "0.0.0.0",
|
||||
"port": 9000
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,10
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Linux way
|
||||
xdebug.remote_connect_back=1
|
||||
|
||||
; idekey value is specific to Sublime
|
||||
xdebug.idekey=sublime.xdebug
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
163
docs/intermediate/configure-php-xdebug/linux/vscode.rst
Normal file
163
docs/intermediate/configure-php-xdebug/linux/vscode.rst
Normal file
@ -0,0 +1,163 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_lin_vscode:
|
||||
|
||||
**********************************************
|
||||
Docker on Linux: Xdebug for Visual Studio Code
|
||||
**********************************************
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install vscode-php-debug for VSCode
|
||||
-----------------------------------
|
||||
|
||||
Ensure you have ``vscode-php-debug`` installed for Visual Studio Code.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_vscode_php_debug|
|
||||
|
||||
Configure VSCode
|
||||
----------------
|
||||
|
||||
You will need to configure the path mapping in ``launch.json`` (VSCode configuration file):
|
||||
|
||||
.. code-block:: json
|
||||
:caption: launch.json
|
||||
:emphasize-lines: 5,9,10
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Xdebug for Project mytest",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"pathMappings": {
|
||||
"/shared/httpd/mytest/htdocs": "${workspaceFolder}/htdocs"
|
||||
}
|
||||
}, {
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 9000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
.. important::
|
||||
The above example configures Xdebug for a single project **mytest**. Add more projects as you need.
|
||||
|
||||
.. seealso::
|
||||
* https://go.microsoft.com/fwlink/?linkid=830387
|
||||
* https://github.com/cytopia/devilbox/issues/381
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,10
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Linux way
|
||||
xdebug.remote_connect_back=1
|
||||
|
||||
; idekey value is specific to Visual Studio Code
|
||||
xdebug.idekey=VSCODE
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
151
docs/intermediate/configure-php-xdebug/macos/atom.rst
Normal file
151
docs/intermediate/configure-php-xdebug/macos/atom.rst
Normal file
@ -0,0 +1,151 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_mac_atom:
|
||||
|
||||
********************************
|
||||
Docker on MacOS: Xdebug for Atom
|
||||
********************************
|
||||
|
||||
.. note:: Docker on MacOS requires you to create a **host address alias** on your loopback device.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
.. important::
|
||||
Ensure you have created an :ref:`howto_host_address_alias_on_mac` and
|
||||
``10.254.254.254`` is aliased to your localhost.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Host address alias | ``10.254.254.254`` (see prerequisites) |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install php-debug for Atom
|
||||
--------------------------
|
||||
|
||||
Ensure you have ``php-debug`` installed for Atom.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_atom_php_debug|
|
||||
|
||||
Configure Atom
|
||||
--------------
|
||||
|
||||
You will need to configure the path mapping in ``config.cson`` (Atom configuration file) or via UI:
|
||||
|
||||
.. code-block:: js
|
||||
:caption: config.cson
|
||||
:emphasize-lines: 6
|
||||
|
||||
"php-debug":
|
||||
{
|
||||
ServerPort: 9000
|
||||
PathMaps: [
|
||||
"remotepath;localpath"
|
||||
"/shared/httpd;/home/cytopia/repo/devilbox/data/www"
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Atom
|
||||
xdebug.idekey=xdebug.atom
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have created a :ref:`howto_host_address_alias_on_mac` pointing to ``10.254.254.254`` as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
144
docs/intermediate/configure-php-xdebug/macos/phpstorm.rst
Normal file
144
docs/intermediate/configure-php-xdebug/macos/phpstorm.rst
Normal file
@ -0,0 +1,144 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_mac_phpstorm:
|
||||
|
||||
************************************
|
||||
Docker on MacOS: Xdebug for PhpStorm
|
||||
************************************
|
||||
|
||||
.. note:: Docker on MacOS requires you to create a **host address alias** on your loopback device.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
.. important::
|
||||
Ensure you have created an :ref:`howto_host_address_alias_on_mac` and
|
||||
``10.254.254.254`` is aliased to your localhost.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Host address alias | ``10.254.254.254`` (see prerequisites) |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Configure PhpStorm
|
||||
------------------
|
||||
|
||||
**1. Ensure Xdebug port is set to 9000**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-settings.rst
|
||||
|
||||
**2. Set path mapping**
|
||||
|
||||
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projects
|
||||
to be in ``./data/www`` of the Devilbox git directory:
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-path-mapping.rst
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
**3. Ensure DBGp proxy settings are configured**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-dbgp-proxy.rst
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 PhpStorm
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have created a :ref:`howto_host_address_alias_on_mac` pointing to ``10.254.254.254`` as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
151
docs/intermediate/configure-php-xdebug/macos/sublime.rst
Normal file
151
docs/intermediate/configure-php-xdebug/macos/sublime.rst
Normal file
@ -0,0 +1,151 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_mac_sublime:
|
||||
|
||||
******************************************
|
||||
Docker on MacOS: Xdebug for Sublime Text 3
|
||||
******************************************
|
||||
|
||||
.. note:: Docker on MacOS requires you to create a **host address alias** on your loopback device.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
.. important::
|
||||
Ensure you have created an :ref:`howto_host_address_alias_on_mac` and
|
||||
``10.254.254.254`` is aliased to your localhost.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Host address alias | ``10.254.254.254`` (see prerequisites) |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install Xdebug Client for Sublime
|
||||
---------------------------------
|
||||
|
||||
Use Sublime's Package Control to search for and install ``Xdebug Client``.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_sublime_xdebug_client|
|
||||
|
||||
Configure Sublime
|
||||
-----------------
|
||||
|
||||
* Navigate to ``Tools`` -> ``Xdebug`` -> ``Settings - User`` in the menu
|
||||
* This will open the configuration file in Sublime
|
||||
|
||||
.. code-block:: json
|
||||
:caption: Xdebug-sublime-settings
|
||||
:emphasize-lines: 3,6
|
||||
|
||||
{
|
||||
"path_mapping": {
|
||||
"/shared/httpd" : "/home/cytopia/repo/devilbox/data/www"
|
||||
},
|
||||
"url": "",
|
||||
"ide_key": "sublime.xdebug",
|
||||
"host": "0.0.0.0",
|
||||
"port": 9000
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Sublime
|
||||
xdebug.idekey=sublime.xdebug
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
171
docs/intermediate/configure-php-xdebug/macos/vscode.rst
Normal file
171
docs/intermediate/configure-php-xdebug/macos/vscode.rst
Normal file
@ -0,0 +1,171 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_mac_vscode:
|
||||
|
||||
**********************************************
|
||||
Docker on MacOS: Xdebug for Visual Studio Code
|
||||
**********************************************
|
||||
|
||||
.. note:: Docker on MacOS requires you to create a **host address alias** on your loopback device.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
.. important::
|
||||
Ensure you have created an :ref:`howto_host_address_alias_on_mac` and
|
||||
``10.254.254.254`` is aliased to your localhost.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Host address alias | ``10.254.254.254`` (see prerequisites) |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install vscode-php-debug for VSCode
|
||||
-----------------------------------
|
||||
|
||||
Ensure you have ``vscode-php-debug`` installed for Visual Studio Code.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_vscode_php_debug|
|
||||
|
||||
Configure VSCode
|
||||
----------------
|
||||
|
||||
You will need to configure the path mapping in ``launch.json`` (VSCode configuration file):
|
||||
|
||||
.. code-block:: json
|
||||
:caption: launch.json
|
||||
:emphasize-lines: 5,9,10
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Xdebug for Project mytest",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"pathMappings": {
|
||||
"/shared/httpd/mytest/htdocs": "${workspaceFolder}/htdocs"
|
||||
}
|
||||
}, {
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 9000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
.. important::
|
||||
The above example configures Xdebug for a single project **mytest**. Add more projects as you need.
|
||||
|
||||
.. seealso::
|
||||
* https://go.microsoft.com/fwlink/?linkid=830387
|
||||
* https://github.com/cytopia/devilbox/issues/381
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Visual Studio Code
|
||||
xdebug.idekey=VSCODE
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have created a :ref:`howto_host_address_alias_on_mac` pointing to ``10.254.254.254`` as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
163
docs/intermediate/configure-php-xdebug/toolbox/atom.rst
Normal file
163
docs/intermediate/configure-php-xdebug/toolbox/atom.rst
Normal file
@ -0,0 +1,163 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_toolbox_atom:
|
||||
|
||||
*******************************
|
||||
Docker Toolbox: Xdebug for Atom
|
||||
*******************************
|
||||
|
||||
Docker Toolbox regardless of running on MacOS or Windows requires an additional port-forward
|
||||
from your host operating system to the Docker Toolbox machine.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Docker Toolbox port-forward
|
||||
---------------------------
|
||||
|
||||
Forward host port 9000 to Docker Toolbox machine:
|
||||
|
||||
Your IDE/editor will open up port ``9000`` on your host operating system. PHP Xdebug requires
|
||||
this port to connect to in order to send Xdebug events.
|
||||
As Docker Toolbox itself runs in a virtual machine, you need to forward traffic from the same
|
||||
port in that virtual machine back to your host operating system.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`howto_ssh_port_forward_on_docker_toolbox_from_host`
|
||||
* :ref:`howto_ssh_port_forward_on_host_to_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install php-debug for Atom
|
||||
--------------------------
|
||||
|
||||
Ensure you have ``php-debug`` installed for Atom.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_atom_php_debug|
|
||||
|
||||
Configure Atom
|
||||
--------------
|
||||
|
||||
You will need to configure the path mapping in ``config.cson`` (Atom configuration file) or via UI:
|
||||
|
||||
.. code-block:: js
|
||||
:caption: config.cson
|
||||
:emphasize-lines: 6
|
||||
|
||||
"php-debug":
|
||||
{
|
||||
ServerPort: 9000
|
||||
PathMaps: [
|
||||
"remotepath;localpath"
|
||||
"/shared/httpd;/home/cytopia/repo/devilbox/data/www"
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Atom
|
||||
xdebug.idekey=xdebug.atom
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure the port-forward is in place as mentioned in the *Prerequisites* section.
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
156
docs/intermediate/configure-php-xdebug/toolbox/phpstorm.rst
Normal file
156
docs/intermediate/configure-php-xdebug/toolbox/phpstorm.rst
Normal file
@ -0,0 +1,156 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_toolbox_phpstorm:
|
||||
|
||||
***********************************
|
||||
Docker Toolbox: Xdebug for PhpStorm
|
||||
***********************************
|
||||
|
||||
Docker Toolbox regardless of running on MacOS or Windows requires an additional port-forward
|
||||
from your host operating system to the Docker Toolbox machine.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Docker Toolbox port-forward
|
||||
---------------------------
|
||||
|
||||
Forward host port 9000 to Docker Toolbox machine:
|
||||
|
||||
Your IDE/editor will open up port ``9000`` on your host operating system. PHP Xdebug requires
|
||||
this port to connect to in order to send Xdebug events.
|
||||
As Docker Toolbox itself runs in a virtual machine, you need to forward traffic from the same
|
||||
port in that virtual machine back to your host operating system.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`howto_ssh_port_forward_on_docker_toolbox_from_host`
|
||||
* :ref:`howto_ssh_port_forward_on_host_to_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Configure PhpStorm
|
||||
------------------
|
||||
|
||||
**1. Ensure Xdebug port is set to 9000**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-settings.rst
|
||||
|
||||
**2. Set path mapping**
|
||||
|
||||
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projects
|
||||
to be in ``./data/www`` of the Devilbox git directory:
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-path-mapping.rst
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
**3. Ensure DBGp proxy settings are configured**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-dbgp-proxy.rst
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 PhpStorm
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure the port-forward is in place as mentioned in the *Prerequisites* section.
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
165
docs/intermediate/configure-php-xdebug/toolbox/sublime.rst
Normal file
165
docs/intermediate/configure-php-xdebug/toolbox/sublime.rst
Normal file
@ -0,0 +1,165 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_toolbox_sublime:
|
||||
|
||||
*****************************************
|
||||
Docker Toolbox: Xdebug for Sublime Text 3
|
||||
*****************************************
|
||||
|
||||
Docker Toolbox regardless of running on MacOS or Windows requires an additional port-forward
|
||||
from your host operating system to the Docker Toolbox machine.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Docker Toolbox port-forward
|
||||
---------------------------
|
||||
|
||||
Forward host port 9000 to Docker Toolbox machine:
|
||||
|
||||
Your IDE/editor will open up port ``9000`` on your host operating system. PHP Xdebug requires
|
||||
this port to connect to in order to send Xdebug events.
|
||||
As Docker Toolbox itself runs in a virtual machine, you need to forward traffic from the same
|
||||
port in that virtual machine back to your host operating system.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`howto_ssh_port_forward_on_docker_toolbox_from_host`
|
||||
* :ref:`howto_ssh_port_forward_on_host_to_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install Xdebug Client for Sublime
|
||||
---------------------------------
|
||||
|
||||
Use Sublime's Package Control to search for and install ``Xdebug Client``.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_sublime_xdebug_client|
|
||||
|
||||
Configure Sublime
|
||||
-----------------
|
||||
|
||||
* Navigate to ``Tools`` -> ``Xdebug`` -> ``Settings - User`` in the menu
|
||||
* This will open the configuration file in Sublime
|
||||
|
||||
.. code-block:: json
|
||||
:caption: Xdebug-sublime-settings
|
||||
:emphasize-lines: 3,6
|
||||
|
||||
{
|
||||
"path_mapping": {
|
||||
"/shared/httpd" : "/home/cytopia/repo/devilbox/data/www"
|
||||
},
|
||||
"url": "",
|
||||
"ide_key": "sublime.xdebug",
|
||||
"host": "0.0.0.0",
|
||||
"port": 9000
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Sublime
|
||||
xdebug.idekey=sublime.xdebug
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure the port-forward is in place as mentioned in the *Prerequisites* section.
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
183
docs/intermediate/configure-php-xdebug/toolbox/vscode.rst
Normal file
183
docs/intermediate/configure-php-xdebug/toolbox/vscode.rst
Normal file
@ -0,0 +1,183 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_toolbox_vscode:
|
||||
|
||||
*********************************************
|
||||
Docker Toolbox: Xdebug for Visual Studio Code
|
||||
*********************************************
|
||||
|
||||
Docker Toolbox regardless of running on MacOS or Windows requires an additional port-forward
|
||||
from your host operating system to the Docker Toolbox machine.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Docker Toolbox port-forward
|
||||
---------------------------
|
||||
|
||||
Forward host port 9000 to Docker Toolbox machine:
|
||||
|
||||
Your IDE/editor will open up port ``9000`` on your host operating system. PHP Xdebug requires
|
||||
this port to connect to in order to send Xdebug events.
|
||||
As Docker Toolbox itself runs in a virtual machine, you need to forward traffic from the same
|
||||
port in that virtual machine back to your host operating system.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`howto_ssh_port_forward_on_docker_toolbox_from_host`
|
||||
* :ref:`howto_ssh_port_forward_on_host_to_docker_toolbox`
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install vscode-php-debug for VSCode
|
||||
-----------------------------------
|
||||
|
||||
Ensure you have ``vscode-php-debug`` installed for Visual Studio Code.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_vscode_php_debug|
|
||||
|
||||
Configure VSCode
|
||||
----------------
|
||||
|
||||
You will need to configure the path mapping in ``launch.json`` (VSCode configuration file):
|
||||
|
||||
.. code-block:: json
|
||||
:caption: launch.json
|
||||
:emphasize-lines: 5,9,10
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Xdebug for Project mytest",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"pathMappings": {
|
||||
"/shared/httpd/mytest/htdocs": "${workspaceFolder}/htdocs"
|
||||
}
|
||||
}, {
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 9000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
.. important::
|
||||
The above example configures Xdebug for a single project **mytest**. Add more projects as you need.
|
||||
|
||||
.. seealso::
|
||||
* https://go.microsoft.com/fwlink/?linkid=830387
|
||||
* https://github.com/cytopia/devilbox/issues/381
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Visual Studio Code
|
||||
xdebug.idekey=VSCODE
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure the port-forward is in place as mentioned in the *Prerequisites* section.
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
172
docs/intermediate/configure-php-xdebug/windows/atom.rst
Normal file
172
docs/intermediate/configure-php-xdebug/windows/atom.rst
Normal file
@ -0,0 +1,172 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_win_atom:
|
||||
|
||||
**********************************
|
||||
Docker on Windows: Xdebug for Atom
|
||||
**********************************
|
||||
|
||||
Docker for Windows requires a well known IP address in order to connect to the host operating
|
||||
system.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Gather DockerNAT IP address
|
||||
---------------------------
|
||||
|
||||
On Windows you will have to manually retrieve the IP address to which Xdebug should connect to
|
||||
via ``xdebug.remote_host``.
|
||||
|
||||
|
||||
1. Open command line
|
||||
2. Enter ``ipconfig``
|
||||
3. Look for the IP4 address in ``DockerNAT`` (e.g.: ``192.168.246.1``)
|
||||
|
||||
.. seealso:: :ref:`howto_open_terminal_on_win`
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| DockerNAT IP address | ``192.168.246.1`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install php-debug for Atom
|
||||
--------------------------
|
||||
|
||||
Ensure you have ``php-debug`` installed for Atom.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_atom_php_debug|
|
||||
|
||||
Configure Atom
|
||||
--------------
|
||||
|
||||
You will need to configure the path mapping in ``config.cson`` (Atom configuration file) or via UI:
|
||||
|
||||
.. code-block:: js
|
||||
:caption: config.cson
|
||||
:emphasize-lines: 6
|
||||
|
||||
"php-debug":
|
||||
{
|
||||
ServerPort: 9000
|
||||
PathMaps: [
|
||||
"remotepath;localpath"
|
||||
"/shared/httpd;/home/cytopia/repo/devilbox/data/www"
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
.. important::
|
||||
On Windows you have to use ``\\`` as directory separators for the local path mapping.
|
||||
E.g.: ``C:\\Users\\projects``.
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Atom
|
||||
xdebug.idekey=xdebug.atom
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have retrieved the correct ``DockerNAT`` IP address as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
161
docs/intermediate/configure-php-xdebug/windows/phpstorm.rst
Normal file
161
docs/intermediate/configure-php-xdebug/windows/phpstorm.rst
Normal file
@ -0,0 +1,161 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_win_phpstorm:
|
||||
|
||||
**************************************
|
||||
Docker on Windows: Xdebug for PhpStorm
|
||||
**************************************
|
||||
|
||||
Docker for Windows requires a well known IP address in order to connect to the host operating
|
||||
system.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Gather DockerNAT IP address
|
||||
---------------------------
|
||||
|
||||
On Windows you will have to manually retrieve the IP address to which Xdebug should connect to
|
||||
via ``xdebug.remote_host``.
|
||||
|
||||
|
||||
1. Open command line
|
||||
2. Enter ``ipconfig``
|
||||
3. Look for the IP4 address in ``DockerNAT`` (e.g.: ``192.168.246.1``)
|
||||
|
||||
.. seealso:: :ref:`howto_open_terminal_on_win`
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| DockerNAT IP address | ``192.168.246.1`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Configure PhpStorm
|
||||
------------------
|
||||
|
||||
**1. Ensure Xdebug port is set to 9000**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-settings.rst
|
||||
|
||||
**2. Set path mapping**
|
||||
|
||||
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projects
|
||||
to be in ``./data/www`` of the Devilbox git directory:
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-path-mapping.rst
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
**3. Ensure DBGp proxy settings are configured**
|
||||
|
||||
.. include:: /_includes/figures/xdebug/phpstorm-dbgp-proxy.rst
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 PhpStorm
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have retrieved the correct ``DockerNAT`` IP address as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
170
docs/intermediate/configure-php-xdebug/windows/sublime.rst
Normal file
170
docs/intermediate/configure-php-xdebug/windows/sublime.rst
Normal file
@ -0,0 +1,170 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_win_sublime:
|
||||
|
||||
********************************************
|
||||
Docker on Windows: Xdebug for Sublime Text 3
|
||||
********************************************
|
||||
|
||||
Docker for Windows requires a well known IP address in order to connect to the host operating
|
||||
system.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Gather DockerNAT IP address
|
||||
---------------------------
|
||||
|
||||
On Windows you will have to manually retrieve the IP address to which Xdebug should connect to
|
||||
via ``xdebug.remote_host``.
|
||||
|
||||
|
||||
1. Open command line
|
||||
2. Enter ``ipconfig``
|
||||
3. Look for the IP4 address in ``DockerNAT`` (e.g.: ``192.168.246.1``)
|
||||
|
||||
.. seealso:: :ref:`howto_open_terminal_on_win`
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| DockerNAT IP address | ``192.168.246.1`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install Xdebug Client for Sublime
|
||||
---------------------------------
|
||||
|
||||
Use Sublime's Package Control to search for and install ``Xdebug Client``.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_sublime_xdebug_client|
|
||||
|
||||
Configure Sublime
|
||||
-----------------
|
||||
|
||||
* Navigate to ``Tools`` -> ``Xdebug`` -> ``Settings - User`` in the menu
|
||||
* This will open the configuration file in Sublime
|
||||
|
||||
.. code-block:: json
|
||||
:caption: Xdebug-sublime-settings
|
||||
:emphasize-lines: 3,6
|
||||
|
||||
{
|
||||
"path_mapping": {
|
||||
"/shared/httpd" : "/home/cytopia/repo/devilbox/data/www"
|
||||
},
|
||||
"url": "",
|
||||
"ide_key": "sublime.xdebug",
|
||||
"host": "0.0.0.0",
|
||||
"port": 9000
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Sublime
|
||||
xdebug.idekey=sublime.xdebug
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have retrieved the correct ``DockerNAT`` IP address as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
188
docs/intermediate/configure-php-xdebug/windows/vscode.rst
Normal file
188
docs/intermediate/configure-php-xdebug/windows/vscode.rst
Normal file
@ -0,0 +1,188 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_win_vscode:
|
||||
|
||||
************************************************
|
||||
Docker on Windows: Xdebug for Visual Studio Code
|
||||
************************************************
|
||||
|
||||
Docker for Windows requires a well known IP address in order to connect to the host operating
|
||||
system.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and have a rough understanding
|
||||
about common Xdebug options.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
Gather DockerNAT IP address
|
||||
---------------------------
|
||||
|
||||
On Windows you will have to manually retrieve the IP address to which Xdebug should connect to
|
||||
via ``xdebug.remote_host``.
|
||||
|
||||
|
||||
1. Open command line
|
||||
2. Enter ``ipconfig``
|
||||
3. Look for the IP4 address in ``DockerNAT`` (e.g.: ``192.168.246.1``)
|
||||
|
||||
.. seealso:: :ref:`howto_open_terminal_on_win`
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
|
||||
Assumption
|
||||
==========
|
||||
|
||||
For the sake of this example, we will assume the following settings and file system paths:
|
||||
|
||||
+------------------------------+------------------------------------------+
|
||||
| Directory | Path |
|
||||
+==============================+==========================================+
|
||||
| Devilbox git directory | ``/home/cytopia/repo/devilbox`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| :ref:`env_httpd_datadir` | ``./data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Resulting local project path | ``/home/cytopia/repo/devilbox/data/www`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| Selected PHP version | ``5.6`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
| DockerNAT IP address | ``192.168.246.1`` |
|
||||
+------------------------------+------------------------------------------+
|
||||
|
||||
The **Resulting local project path** is the path where all projects are stored locally on your
|
||||
host operating system. No matter what this path is, the equivalent remote path (inside the Docker
|
||||
container) is always ``/shared/httpd``.
|
||||
|
||||
.. important:: Remember this, when it comes to path mapping in your IDE/editor configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Install vscode-php-debug for VSCode
|
||||
-----------------------------------
|
||||
|
||||
Ensure you have ``vscode-php-debug`` installed for Visual Studio Code.
|
||||
|
||||
.. seealso:: |ext_lnk_xdebug_ide_vscode_php_debug|
|
||||
|
||||
Configure VSCode
|
||||
----------------
|
||||
|
||||
You will need to configure the path mapping in ``launch.json`` (VSCode configuration file):
|
||||
|
||||
.. code-block:: json
|
||||
:caption: launch.json
|
||||
:emphasize-lines: 5,9,10
|
||||
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Xdebug for Project mytest",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"pathMappings": {
|
||||
"/shared/httpd/mytest/htdocs": "${workspaceFolder}/htdocs"
|
||||
}
|
||||
}, {
|
||||
"name": "Launch currently open script",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"cwd": "${fileDirname}",
|
||||
"port": 9000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
.. important::
|
||||
Recall the path settings from the *Assumption* section and adjust if your configuration differs!
|
||||
|
||||
.. important::
|
||||
The above example configures Xdebug for a single project **mytest**. Add more projects as you need.
|
||||
|
||||
.. seealso::
|
||||
* https://go.microsoft.com/fwlink/?linkid=830387
|
||||
* https://github.com/cytopia/devilbox/issues/381
|
||||
|
||||
Configure php.ini
|
||||
-----------------
|
||||
|
||||
.. note:: The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
Create an ``xdebug.ini`` file (must end by ``.ini``):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
Copy/paste all of the following lines into the above created ``xdebug.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,8,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 Visual Studio Code
|
||||
xdebug.idekey=VSCODE
|
||||
|
||||
; Optional: Set to true to always auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important:: Ensure you have retrieved the correct ``DockerNAT`` IP address as stated in the prerequisites section above!
|
||||
|
||||
.. note:: Host os and editor specific settings are highlighted in yellow and are worth googling to get a better understanding of the tools you use and to be more efficient at troubleshooting.
|
||||
|
||||
|
||||
Restart the Devilbox
|
||||
--------------------
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
Note that the following example only starts up PHP, HTTPD and Bind.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Stop, remove stopped container and start
|
||||
host> docker-compose stop
|
||||
host> docker-compose rm
|
||||
host> docker-compose up php httpd bind
|
||||
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox_stop_and_restart` (Why do ``docker-compose rm``?)
|
@ -1,99 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_docker_toolbox:
|
||||
|
||||
********************************
|
||||
Configure Xdebug: Docker Toolbox
|
||||
********************************
|
||||
|
||||
Docker Toolbox regardless of running on MacOS or Windows requires an additional port-forward
|
||||
from your host operating system to the Docker Toolbox machine.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Configure php.ini
|
||||
=================
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Forward host port 9000 to Docker Toolbox machine**
|
||||
|
||||
Your IDE/editor will open up port ``9000`` on your host operating system. PHP Xdebug requires
|
||||
this port to connect to in order to send Xdebug events.
|
||||
As Docker Toolbox itself runs in a virtual machine, you need to forward traffic from the same
|
||||
port in that virtual machine back to your host operating system.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`howto_ssh_port_forward_on_docker_toolbox_from_host`
|
||||
* :ref:`howto_ssh_port_forward_on_host_to_docker_toolbox`
|
||||
|
||||
**2. Create xdebug.ini**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
**3. Paste the following content into xdebug.ini**
|
||||
|
||||
Once the por-forward is up, the configuration matches the one for Docker on Linux
|
||||
|
||||
.. seealso::
|
||||
* CNAME for :ref:`connect_to_host_os_docker_on_linux`
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 6-7,11
|
||||
|
||||
; 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 your IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
**4. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
|
||||
**5. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
@ -1,86 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_lin:
|
||||
|
||||
*********************************
|
||||
Configure Xdebug: Docker on Linux
|
||||
*********************************
|
||||
|
||||
Docker on Linux allows Xdebug to automatically connect back to the host system without the need
|
||||
of an explicit IP address.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Configure php.ini
|
||||
=================
|
||||
|
||||
Configuring Xdebug for Docker on Linux is straight forward and you must only pay attention to
|
||||
two variables highlighted below.
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Create xdebug.ini**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
**2. Paste the following content into xdebug.ini**
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7,11
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
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 your IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
**3. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
|
||||
**4. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
@ -1,175 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_mac:
|
||||
|
||||
********************************
|
||||
Configure Xdebug: Docker for Mac
|
||||
********************************
|
||||
|
||||
Docker for MacOS requires a well known IP address in order to connect to the host operating system.
|
||||
This can be achieved with two different approaches described below.
|
||||
|
||||
.. seealso:: https://forums.docker.com/t/ip-address-for-xdebug/10460/32
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and Xdebug is enabled.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Configure php.ini: CNAME alias
|
||||
==============================
|
||||
|
||||
**Option 1:** This option is the easiest to setup, but was also very fragile on many Docker versions.
|
||||
|
||||
Docker for Mac received many default CNAMEs throughout its versions. The most recent and active
|
||||
one is ``host.docker.internal``. Use this CNAME as the remote address for Xdebug to connect to your
|
||||
IDE/editor on your host os.
|
||||
|
||||
.. seealso::
|
||||
CNAME for :ref:`connect_to_host_os_docker_for_mac`
|
||||
In case ``host.docker.internal`` is not resolvable, read on here for alternative CNAME's
|
||||
on Docker for Mac
|
||||
|
||||
.. important::
|
||||
|
||||
Before you try this approach, verify that the PHP Docker container is actually able to resolve
|
||||
``host.docker.internal``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd path/to/devilbox
|
||||
host> ./shell.sh
|
||||
php> ping host.docker.internal
|
||||
|
||||
In case it is not resolvable, stick to the host alias address approach.
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Create xdebug.ini**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
**2. Paste the following content into xdebug.ini**
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7-8,12
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The MacOS way (CNAME)
|
||||
xdebug.remote_connect_back=0
|
||||
xdebug.remote_host=host.docker.internal
|
||||
|
||||
; idekey value is specific to each editor
|
||||
; Verify IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
**3. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
|
||||
**4. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
|
||||
Configure php.ini: Host alias
|
||||
=============================
|
||||
|
||||
**Option 2:** This is the most general option that should work with any Docker version on MacOS,
|
||||
it does however require a few changes in your system.
|
||||
|
||||
.. important::
|
||||
Ensure you have created an :ref:`howto_host_address_alias_on_mac` and
|
||||
``10.254.254.254`` is aliased to your localhost.
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Create xdebug.ini**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to the Devilbox git directory
|
||||
host> cd path/to/devilbox
|
||||
|
||||
# Navigate to PHP 5.6 ini configuration directory
|
||||
host> cd cfg/php-ini-5.6/
|
||||
|
||||
# Create and open debug.ini file
|
||||
host> vi xdebug.ini
|
||||
|
||||
**2. Paste the following content into xdebug.ini**
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7-8,12
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The MacOS way (host alias)
|
||||
xdebug.remote_connect_back=0
|
||||
xdebug.remote_host=10.254.254.254
|
||||
|
||||
; idekey value is specific to each editor
|
||||
; Verify with your IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
**3. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
|
||||
**4. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
@ -1,177 +0,0 @@
|
||||
:orphan:
|
||||
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _configure_php_xdebug_win:
|
||||
|
||||
************************************
|
||||
Configure Xdebug: Docker for Windows
|
||||
************************************
|
||||
|
||||
Docker for Windows requires a well known IP address in order to connect to the host operating system.
|
||||
This can be achieved with two different approaches described below.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Ensure you know how to customize ``php.ini`` values for the Devilbox and Xdebug is enabled.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`php_ini`
|
||||
* :ref:`configure_php_xdebug_options`
|
||||
|
||||
|
||||
Configure php.ini: CNAME alias
|
||||
==============================
|
||||
|
||||
**Option 1:** This option is the easiest to setup, but was also very fragile on many Docker versions.
|
||||
|
||||
Docker for Windows received many default CNAMEs throughout its versions. The most recent and active
|
||||
one is ``host.docker.internal``. Use this CNAME as the remote address for Xdebug to connect to your
|
||||
IDE/editor on your host os.
|
||||
|
||||
.. seealso::
|
||||
CNAME for :ref:`connect_to_host_os_docker_for_win`
|
||||
In case ``host.docker.internal`` is not resolvable, read on here for alternative CNAME's
|
||||
on Docker for Windows
|
||||
|
||||
.. important::
|
||||
|
||||
Before you try this approach, verify that the PHP Docker container is actually able to resolve
|
||||
``host.docker.internal``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
C:\> cd path\to\devilbox
|
||||
C:\> shell.bat
|
||||
php> ping host.docker.internal
|
||||
|
||||
In case it is not resolvable, stick to the host alias address approach.
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Create xdebug.ini**
|
||||
|
||||
1. Navigate to the Devilbox directory
|
||||
2. Navigate to ``cfg\php-ini-5.6\`` directory
|
||||
3. Create a new file named ``xdebug.ini``
|
||||
|
||||
.. important::
|
||||
Pay attention that windows is not adding ``.txt`` as a file extension.
|
||||
|
||||
**2. Paste the following content into xdebug.ini**
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7-8,12
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Windows way (CNAME)
|
||||
xdebug.remote_connect_back=0
|
||||
xdebug.remote_host=host.docker.internal
|
||||
|
||||
; idekey value is specific to each editor
|
||||
; Verify IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
**3. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
**4. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
||||
|
||||
|
||||
Configure php.ini: Get IP manually
|
||||
==================================
|
||||
|
||||
**Option 2:** This is the most general option that should work with any Docker version on Windows.
|
||||
it does however require a small manual step.
|
||||
|
||||
The following example show how to configure PHP Xdebug for PHP 5.6:
|
||||
|
||||
**1. Gather IP address for Xdebug**
|
||||
|
||||
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``)
|
||||
|
||||
.. seealso:: :ref:`howto_open_terminal_on_win`
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
**2. Create xdebug.ini**
|
||||
|
||||
1. Navigate to the Devilbox directory
|
||||
2. Navigate to ``cfg\php-ini-5.6\`` directory
|
||||
3. Create a new file named ``xdebug.ini``
|
||||
|
||||
.. important::
|
||||
Pay attention that windows is not adding ``.txt`` as a file extension.
|
||||
|
||||
**3. Paste the following content into xdebug.ini**
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: xdebug.ini
|
||||
:emphasize-lines: 7-8,12
|
||||
|
||||
; Defaults
|
||||
xdebug.default_enable=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_port=9000
|
||||
|
||||
; The Windows way (IP address)
|
||||
xdebug.remote_connect_back=0
|
||||
xdebug.remote_host=192.168.246.1
|
||||
|
||||
; idekey value is specific to each editor
|
||||
; Verify IDE/editor documentation
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
; Optional: Set to true to auto-start xdebug
|
||||
xdebug.remote_autostart=false
|
||||
|
||||
.. important::
|
||||
``192.168.246.1`` is meant as an example and will eventually differ on your system.
|
||||
Ensure you substitute it with the correct IP address.
|
||||
|
||||
**4. Configure your IDE/editor**
|
||||
|
||||
.. seealso::
|
||||
* :ref:`configure_php_xdebug_editor_atom`
|
||||
* :ref:`configure_php_xdebug_editor_phpstorm`
|
||||
* :ref:`configure_php_xdebug_editor_sublime3`
|
||||
* :ref:`configure_php_xdebug_editor_vscode`
|
||||
|
||||
.. important::
|
||||
Depending on your IDE/editor, you might have to adjust ``xdebug.idekey`` in the above
|
||||
configured ``xdebug.ini``.
|
||||
|
||||
**5. Restart the Devilbox**
|
||||
|
||||
Restarting the Devilbox is important in order for it to read the new PHP settings.
|
@ -336,8 +336,8 @@ to read-only by applying the following ``chmod`` command.
|
||||
Docker Toolbox
|
||||
==============
|
||||
|
||||
ln: creating symbolic link `./foo': Read-only file system
|
||||
---------------------------------------------------------
|
||||
ln: creating symbolic link './foo': Read-only file system
|
||||
----------------------------------------------------------
|
||||
|
||||
VirtualBox might not allow symlinks by default on other directories. This can however be fixed
|
||||
manually via.
|
||||
|
Loading…
x
Reference in New Issue
Block a user