Xdebug For Phpstorm
- Xdebug Phpstorm Not Working
- Xdebug Phpstorm Docker
- Phpstorm Xdebug Docker Cli
- Xdebug Phpstorm Ubuntu
- Phpstorm Xdebug Docker
Xdebug: A powerful debugger for PHP. This setting controls which Xdebug features are enabled. This setting can only be set in php.ini or files like 99-xdebug.ini that are read when a PHP process starts (directly, or through php-fpm), but not in.htaccess and.user.ini files, which are read per-request. The following values are accepted. Phpxdebug: 1 phpxdebugdefaultenable: 1 phpxdebugremoteconnectback: 0 phpideconfig: servername=phpstorm phpxdebugidekey: 'phpstorm' phpxdebugremotehost: 172.17.0.1 # linux If you enable these after you've created the PHP container, remember to restart the container so that xdebug is enabled and configured.
This article will show you step by step how to install and use Xdebug on Windows.
Contents:
Xdebug is an extension for PHP to assist with debugging and development. Makes development easier by allowing the developer to debug his code in a simple and quick way. How to install Xdebug. In this tutorial, we will be installing Xdebug on Windows 10, the steps are similar for any Windows version. Turn on XDebug inside the VM; Start listening for connections in PhpStorm by clicking the small telephone icon; Load a VM page in your browser PhpStorm will detect a request to connect, but will complain that path mappings are not set up. This is fine, we’re about to do that. How do you map an incoming xdebug connection when your directory structure is split between a public folder which is the entry point for CodeIgniter and the rest of the CodeIgniter framework code in the server folder? It looks like this: I was able to successfully create and run a docker deployment in PhpStorm: Deploying 'Compose: docker'.
Resources:
Official Xdebug installation guide from JetBrains (really good)
What is Xdebug?
Xdebug is an extension for PHP to assist with debugging and development.
Why use Xdebug?
Makes development easier by allowing the developer to debug his code in a simple and quick way.
How to install Xdebug
In this tutorial, we will be installing Xdebug on Windows 10, the steps are similar for any Windows version. You must have PHP installed on your system.
- Go here and install Xdebug:
- Run the following command in a terminal:
- Copy the output of that command and paste it in the Xdebug Wizard. Then click Analyze my phpinfo() output.
- Once analyzed, the result will tell if you have Xdebug installed or not, and which .dll file to download.
- Download the specified file from the step before. For me is: php_xdebug-2.6.0-7.2-vc15-nts-x86_64.dll
- Move the downloaded file to the /ext folder. This is the folder where PHP keeps all of its extensions and can be found under the folder where you have installed PHP. On mine, it is located in C:PHPext.
- Open php.ini file in an editor like Notepad, Notepad++ or Visual Code. This file is located within the folder where you installed PHP, C:PHPphp.ini for me.
- At the end of this file, add the following lines:
- Check if Xdebug has been installed by running the following command in a terminal:
The line that says ‘with Xdebug v2.7.0alpha1’ confirms that it has been installed correctly.
Copy file to ext directory
Docker for Windows requires a well known IP address in order to connect to the host operatingsystem.
Table of Contents
- Prerequisites
- Configuration
Ensure you know how to customize php.ini values for the Devilbox and have a rough understandingabout common Xdebug options.
On Windows you will have to manually retrieve the IP address to which Xdebug should connect tovia xdebug.remote_host.
When you have done no custom configuration in your Virtual Switch manager, Docker for Windows willuse the DefaultSwitch automatically.
Windows: Virtual Switch Manager example screenshot
Open command line
Enter
ipconfigLook for the IP4 address in
DefaultSwitch(e.g.:192.168.0.12)
Important
192.168.0.12 is meant as an example and will eventually differ on your system.Ensure you substitute it with the correct IP address.
For the sake of this example, we will assume the following settings and file system paths:
Xdebug Phpstorm Not Working
| Directory | Path |
|---|---|
| Devilbox git directory | /home/cytopia/repo/devilbox |
| HOST_PATH_HTTPD_DATADIR | ./data/www |
| Resulting local project path | /home/cytopia/repo/devilbox/data/www |
| Selected PHP version | 5.6 |
| DockerNAT IP address | 192.168.0.12 |
| Virtual Switch IP address | 192.168.0.12 |
The Resulting local project path is the path where all projects are stored locally on yourhost operating system. No matter what this path is, the equivalent remote path (inside the Dockercontainer) is always /shared/httpd.

Important
Remember this, when it comes to path mapping in your IDE/editor configuration.
1. Ensure Xdebug port is set to 9000
2. Set path mapping
Create a new PHP server and set a path mapping. This tutorial assumes your local Devilbox projectsto be in ./data/www of the Devilbox git directory:
Important
Recall the path settings from the Assumption section and adjust if your configuration differs!
3. Ensure DBGp proxy settings are configured
Note
The following example show how to configure PHP Xdebug for PHP 5.6:
Create an xdebug.ini file (must end by .ini):
Copy/paste all of the following lines into the above created xdebug.ini file:
Xdebug Phpstorm Docker
Important
Ensure you have retrieved the correct DockerNAT IP address as stated in the prerequisites section above!
Note
Phpstorm Xdebug Docker Cli
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.
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.
Xdebug Phpstorm Ubuntu
See also
Phpstorm Xdebug Docker
Stop and Restart (Why do docker-composerm?)

