Configure Xdebug in PhpStorm In the Settings/Preferences dialog Ctrl+Alt+S, select PHP. Check the Xdebug installation associated with the selected PHP interpreter: On the PHP page, choose the relevant PHP installation from the CLI Interpreter list and click next to the field.
PhpStorm 2020.3 is now available! This major release includes full support for PHP 8, static analyzers PHPStan and Psalm, Xdebug 3, Tailwind CSS, collaborative development via Code With Me, and much more. Download PhpStorm 2020.3 Read on for details on all the new features and significant updates, along with a ton of GIFs! In this tutorial, we will look into how to set up PhpStorm to use Xdebug in a dockerized PHP project. For a non-trivial PHP project example, we choose the development of a WordPress theme. Prerequisites PhpStorm is a popular PHP IDE with many useful features including Docker and Xdebug support. In this tutorial, we are.
FeaturesNewsletterTutorialsPhpStorm provides visual representation of profiling data generated by Xdebug. You can select several snapshots at a time and collect the aggregated profiling information. Before profiling with Xdebug, download, install and configure the components of the PHP development environment. Sudo apt-get install php5-xdebug (Debian based servers).
So, you’ve decided to try something new today and started a project from scratch. Your first step will be to set up a development environment: at the bare minimum, you’d want to run a web server and a PHP interpreter (preferably – with the debugging engine installed).
With Docker, you can start developing, running, and debugging your code in a matter of minutes!
Probably the easiest way to integrate Docker with PhpStorm is to use the PhpStorm Docker registry. It provides a selection of preconfigured Docker images curated by the PhpStorm team, which cover the most common PHP development needs.
Before you proceed, make sure that you have Docker installed on your machine: see how to do it on Windows and on macOS.
Defining the environment
To get started, we create a new project in PhpStorm. Next, we create a new file named docker-compose.yml , which will describe the configuration of the services comprising our app. In our case, it will be a single webserver service:
As you can see, we use the preconfigured Docker image comprising the Apache web server and PHP 7.1 with Xdebug.
Note that we use the host.docker.internal value to refer to the remote host. In Docker for Windows and Docker for Mac, it automatically resolves to the internal address of the host, letting you easily connect to it from the container.
An important note for Linux users: host.docker.internal on Linux is currently not supported. You’ll have to use your local machine’s hostname instead (to find out what your machine’s hostname is, simply execute hostname in Terminal).
The corresponding environment configuration section for Linux will read as follows:
See here for more details and possible workarounds.
Our environment is fully described:
We can now start using it by creating a dedicated run/debug configuration.
Creating a run/debug configuration
Right-click docker-compose.yml and select Create… from the context menu:
Phpstorm Xdebug Port 9000 Is Busy
In the dialog that opens, provide the name of the configuration and apply your changes:
You can now start the configuration from the toolbar:
PhpStorm will automatically download the required image and start the web server:
That’s it: we’ve got everything ready for running and debugging our code!
Running and debugging code
Let’s ensure that everything works as expected. To do this, we’ll create the most simple Hello world PHP file and try to debug it following the PhpStorm Zero-Configuration Debugging approach.
Since we already have Xdebug installed and configured, this will only require that you:
- Have a debugging extension installed and enabled for your browser:
- Set a breakpoint in your code:
- Enable listening to incoming debug connections in PhpStorm:
Now, simply open the page in the browser, and the debugging session will be started automatically:
We encourage you to further explore the PhpStorm Docker registry: while we’ve looked at a very simple case, you can use the described technique to provide your environment with, for example, a database, or an sftp server.
Using these Docker images will save you a lot of effort and let you start coding in a matter of a minute, or even less!
If you’d like to learn more about Docker and how to use it in PhpStorm, make sure to check out the excellent tutorial series by Pascal Landau, and PhpStorm documentation, of course.
Your JetBrains PhpStorm Team
The Drive to Develop
Hello,
after 2 days and lots of cofee i get it working! Almost…
Phpstorm Xdebug Php.ini
first i used before phpedit but it was dead since some years so i finally jump to komodo after read lot comparaison beetween phpstorm, visual studio, komodo…
and i like it, easy to use for first time good with CodeIgniter the framework i use actively
my environnement:
VMWare 15
->Windows 10 x64
–>Komodo 12.0.1
–>WAMP 3.2.5
—>Apache 2.4.46
---->PHP 7.3.27
----->XDEBUG 3.0.4 from xdebug.org (PHP 7.3 VC15 TS (64 bit))
so in komodo doc its writed: use version from komodo first problem it’s for PHP 7.2 the last one.
so i use official and this in php.ini:
Phpstorm Xdebug Php 5.6
if i call webpage with ?XDEBUG_SESSION_START=komodo
and in code i put xdebug_break(); in php file
komodo stop on xdebug_break(); but ignore break point red in komodo
so if someone have idea for make break point running it will be great very very great since put xdebug_break(); in my code cant be the solution to use every day
Phpstorm Xdebug Not Working
thanks for read.