guyfert.blogg.se

Phpstorm debug docker
Phpstorm debug docker









phpstorm debug docker
  1. Phpstorm debug docker install#
  2. Phpstorm debug docker update#
  3. Phpstorm debug docker for windows 10#

In this case, open the project settings and under “Languages and Frameworks” > “PHP” > “Servers” delete all server configurations. Also, make sure that the daemon is exposed at port 2375 as described in the “Prerequisites” section earlier in this post.Īnother problem can happen when PhpStorm fails to start the service containers with an error message like this:Ĭannot accept external Xdebug connection: Cannot evaluate expression 'isset($_SERVER)' To fix this, open Docker Desktop and check if there is any problem with the docker daemon. “Cannot connect: Cannot connect to the Docker daemon at tcp://localhost:2375. If the “Server” setting does not show “Docker”, it means that PhpStorm can’t connect to the Docker daemon. However, you might want to check “–build, force build images” if your project has some changes that can affect the composition of the services’ images. This will open the “Create Run Configuration” dialog that looks like this:įor our project, there is nothing required to change in this dialog. To do that, in the project view right-click the file docker-compose-local.yml and select “Create docker-compose-local…”:

phpstorm debug docker

We are now ready to launch the prepared WordPress project using PhpStorm Docker tools.įirst, we need to create a Run Configuration.

Phpstorm debug docker install#

We name the Dockerfile Dockerfile_local and add instructions there that install and enable the Xdebug extension: MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORDĬommand: '-default-authentication-plugin=mysql_native_password'įile docker-compose-local.yml Xdebug Installationįor the service wp, we need a custom image based on WordPress docker image tagged 5.4.1-php7.2-apache. env file is used by both services contains variables and is required for the MySQL operation. But in the development environment, we still need the core files in the project to step into them when debugging. We do not need the core files to be deployed live from the repository, because they will be provided by a WordPress official image that will be the basis for the live version of the container. We place the core WordPress files into a separate directory so that we could exclude it from the repository using. src/themes/beonepage that hosts the files for the custom theme. src/wordpress/ for the core WordPress files and. Note that we bind two project directories as volumes. The build instructions for this image will be available in a separate Dockerfile. src/themes/beonepage:/var/www/html/wp-content/themes/beonepage The first one is for the database server: In an empty project folder, we create a docker-compose configuration file, docker-compose-local.yml. The tag used in this project is 5.4.1-php-7.2-apache. The project will use a container built from an official WordPress image. The companion repository for this tutorial can be found on GitHub: wordpress_xdebug Project Setup For simplicity’s sake, we will be debugging an existing theme BeOnePage Lite by BeTheme. The WordPress theme that is the subject of this development project can be a scratch-built custom one or a modification of an existing theme.

Phpstorm debug docker update#

It should work also with newer versions: download the most recent WordPress and update the reference to the newer WordPress Docker image in the Dockerfile that is mentioned below. The version of WordPress we are going to work with is 5.4.1. To check if it is, go to Settings > Generaland tick the respective checkbox: Make sure the Docker Daemon is exposed on port 2375.

phpstorm debug docker

Phpstorm debug docker for windows 10#

This tutorial is written for Windows 10 and Docker Desktop running Linux containers.

phpstorm debug docker

You will need the Xdebug helper for Chrome or an equivalent helper for other browsers. In this tutorial, we are using version 2019.3.2. PhpStorm is a popular PHP IDE with many useful features including Docker and Xdebug support.











Phpstorm debug docker