Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
YouTube Security Videosheise & c't: Gebrauchte CPU gekauft – plötzlich ist der PC gesperrt(01.10.2026 um 13:08 Uhr)
•
Windows Tipps & SecuritySD-Karten sind teuer wie nie: So halten sie deutlich länger(01.10.2026 um 13:15 Uhr)
•••••••••
YouTube Security Videosheise & c't: Gebrauchte CPU gekauft – plötzlich ist der PC gesperrt(01.10.2026 um 13:08 Uhr)
•
Windows Tipps & SecuritySD-Karten sind teuer wie nie: So halten sie deutlich länger(01.10.2026 um 13:15 Uhr)
•••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Docker for PHP begginers as simple as possible

I would like to target this article at beginners because I haven’t been able to find a proper article about a simple container for PHP. I want to give a h…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

I would like to target this article at beginners because I haven’t been able to find a proper article about a simple container for PHP. I want to give a heads-up to nitpickers in advance that I’m focusing only on the simplest approach.

Please note that I am working on Windows, but aside from a few minor details, the process is the same on macOS or Linux.






The premise is to have Docker installed. I won’t cover this in the article, as it depends on your operating system. However, it’s not too complicated.



Additionally, I have one recommendation for Windows users: use WSL2. The instructions are available Microsoft: How to install Linux on Windows with WSL, and based on my experience, installation is just a matter of following a few commands from the page. If you carefully follow the steps one by one, you’ll get it done successfully.









If everything is ready, we can dive in.





  1. Start Docker


    • Icon that indicates whether the Docker is running
      Image description




  2. Launch your favorite PHP editor/IDE
    – I'm using IntelliJ PHPStorm


  3. Create a new project in Ubuntu (see the WSL2 installation above)


    • I created mine in the following directory: \\wsl.localhost\Ubuntu\home\development\docker-php-simple
      Image description




  4. In the project directory, create the following files and folder structure
    Image description


  5. Now, let's add content to these three files:



    • public/index.php: Prepare a nice piece of code that welcomes you :-)






<?php

echo 'Hello, Developer!';









  • .docker/apache/sites-available/000-default.conf: A simple configuration that specifies the default directory of our website




<VirtualHost *:80>
DocumentRoot "/var/www/html/public"
</VirtualHost>








  • docker-compose.yml: Configuration settings for the Docker containers




services:
app:
image: php:8.4-apache
container_name: docker-php-simple
tty: true
volumes:
# Mount the current directory to the /var/www/html directory in the container
# It means that the files in the current directory (./) will be available in the container at /var/www/html
- ./:/var/www/html
# Apache configuration file for the virtual host
- ./.docker/apache/sites-available/000-default.conf:/etc/apache2/sites-available/000-default.conf
# working_dir: /var/www/html
ports:
# Your web server will be available at http://localhost:8080
- "8080:80"












Let's get it running!



Follow these steps based on your preferred method:






Option 1: Using the Docker Plugin in Your Editor




  1. Open the docker-compose.yml file in your editor.

  2. Look for the double arrows (in PHPStorm) (▶︎▶︎) in the interface and click them. This will start your Docker containers. The starting process and result is visible in IDE's console.



Image description






Option 2: Using a Terminal




  1. Open your terminal (e.g., Git Bash, Command Prompt, or any terminal you prefer).

  2. Navigate to your project directory

  3. Run the following command to start the containers:




   docker-compose up -d






Once the containers are up, your application should be running.



You can open the Docker application, and you should see a running container with your application, named docker-php-simple.



If everything is set up correctly, the container should have a "Running" status, and you can manage it directly from the Docker dashboard, such as stopping, restarting, or inspecting logs if needed. 🎉

Image description









And as the grand finale, here is our application in action! 🎉



Check it in your browser by accessing the appropriate URL http://localhost:8080/ or the port specified in your Docker configuration. 🚀



You should see your welcome message Hello, Developer!

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph4 Knoten / 3 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Docker for PHP begginers as simple as possible

Thematisch verwandte Begriffe: Docker, begginers, simple, possible · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag