Create a multi-container PHP app with Docker Compose

In this tutorial you'll learn how to create more than one container and communicate between them. This requires Docker compose which is a great way for local developing and testing your projects.

In this tutorial you'll learn how to create more than one container and communicate between them. This requires Docker compose which is a great way for local developing and testing your projects.

Welcome to the third article of PHP on Docker. In the previous article, we learned how to create two connected containers with php and nginx with the help of Docker compose, and we also talked about different environments where your software needs to work.

In the previous article, we talked about Docker and created a simple Docker Image with PHP inside Visual Studio Code. If you did not read it yet, I strongly recommend reading it before, since you'll have more context for this one. In this article, we will create a multi-container application using PHP and Nginx with the help of Docker Compose. You can see all the files we will be creating on github.

I'm sure you have already heard something about it. Docker -the technology that completely took over the software world in the past few years. This article explains what Docker is and how to use it with PHP inside Visual Studio Code.

The objects sometimes misbehave. You watch them closely when your are debugging and they behave as they should - they know you are watching. You are stepping through the code, sinking deeper into the methods. When you surface back and see your old objects again, they are different, their properties have changed. Something happened to them behind your back.

Very often a PHP project consists of several separately hosted applications, such as a public website and some API. In case developer wants to run and debug his set of applications locally, there is a very useful feature in VS Code called compound launch.

Working on a PHP project in Visual Studio may start in two ways; either opening a folder (File | Open | Folder), or creating a regular Visual Studio project (File | New | Project). Although both approaches work, we're recommending the seconds option, since it provides much more features and the full blown Visual Studio experience. Let's take a look on the New Project Wizards.

XAMPP is a cross-platform Apache HTTP server distribution containing MariaDB (fork of MySQL) database, PHP, and Perl. The word "XAMPP" is an acronym and it seems there is no official explaning of if, but we can safely assume that "X" stands for "cross", meaning "cross-platform", A would be Apache, M is MariaDB. While first P would be short for PHP and second P for Pearl or reversed?

Visual Studio Code and Windows Subsystem for Linux (WSL): those represent a great couple for developing a PHP application such as Laravel inside a virtual Linux environment. This tutorial describes installation of WSL (version 2) on Windows 10, setting up PHP with debugging capabilities in there, creating a Laravel project, and getting your VS Code ready to debug the PHP project in WSL.