In the dialog that opens, provide the name of the configuration and apply your changes: Right-click docker-compose.yml and select Create… from the context menu: We can now start using it by creating a dedicated run/debug configuration. See here for more details and possible workarounds. The corresponding environment configuration section for Linux will read as follows: 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). 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.Īn important note for Linux users: on Linux is currently not supported. Note that we use the value to refer to the remote host. In our case, it will be a single webserver service:Īs you can see, we use the preconfigured Docker image comprising the Apache web server and PHP 7.1 with Xdebug. Next, we create a new file named docker-compose.yml, which will describe the configuration of the services comprising our app. To get started, we create a new project in PhpStorm.
It provides a selection of preconfigured Docker images curated by the PhpStorm team, which cover the most common PHP development needs.īefore you proceed, make sure that you have Docker installed on your machine: see how to do it on Windows and on macOS. Probably the easiest way to integrate Docker with PhpStorm is to use the PhpStorm Docker registry.
With Docker, you can start developing, running, and debugging your code in a matter of minutes! 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). So, you’ve decided to try something new today and started a project from scratch. To do that, we need to setup remote debugging for XDebug so that PHPStorm can connect to it and set breakpoints, show variable values and step through the code.FeaturesNewsletterTutorials So the idea is to write PHP code in PHPStorm on Windows and run and debug PHP code on Ubuntu over WSL2. Add a new server and set the host to localhost and the port to whatever port you are publishing your docker-compose web service to. Configure PHPStorm's local server to point to your docker service by going to File Settings Languages & Frameworks PHP Servers.
Longtime Mac or Windows Lando users will be familiar with the performance difficulties associated with file system access when using Docker in a non-linux host environment. WSL2 provides a near-native Linux experience for developing web applications on Windows computers.