Skip to content

selinachegg/php-docker-environment

Repository files navigation

PHP Docker Environment

PHP Docker Environment

XAMPP equivalent — ready to use, zero configuration.
Apache 2.4 · PHP 7.4 · MariaDB 10.6 · phpMyAdmin · Portainer

PHP 7.4 MariaDB Docker macOS 14+ Windows


Setup — 3 steps

1. Install Docker Desktop (once)

Download and install Docker Desktop for your system.

Windows: Docker Desktop automatically installs everything it needs (including WSL2). Restart if prompted.

2. Download this project

Option A — Without Git (beginners)

  1. On this page, click the green <> Code button (top right)
  2. Click Download ZIP
  3. Open the downloaded ZIP file
  4. Extract (unzip) the folder to your Desktop
  5. Name the folder PHPenv

Option B — With Git

cd ~/Desktop
git clone https://github.com/selinachegg/php-docker-environment.git PHPenv

3. Launch

Launcher (recommended) — An interactive menu to manage everything:

System Command
Windows Double-click launcher.bat
macOS Double-click launcher.command

The launcher lets you start, stop, restart the environment and reset Portainer from a single menu.

Individual scripts (start.bat, stop.bat, start.command, stop.command) remain available for manual use.

The first launch takes 5 to 10 minutes (downloading images). After that: ~10 seconds.


Your services

Service URL Description
🌐 PHP Site localhost:8080 Your PHP files (htdocs/ folder)
🗄️ phpMyAdmin localhost:8081 Visual database management
🐳 Portainer localhost:9000 Visual Docker container management
🏠 Dashboard localhost:8082 Home page with all links

Working with PHP

Your PHP files go in the htdocs/ folder. Changes are instant — no restart needed.

<?php
// htdocs/hello.php → http://localhost:8080/hello.php
echo "Hello world!";
?>

Database connection

<?php
$pdo = new PDO(
    "mysql:host=db;dbname=app;charset=utf8mb4",
    "app",   // username
    "app"    // password
);
?>
Parameter Value
Host db
Database app
Username app
Password app
Root password root

Full tutorial

Open the Interactive tutorial (HTML) in your browser for the complete step-by-step guide (Mac and Windows).

PDF versions are also available in the tutorials/ folder:


Quick troubleshooting

Problem Solution
Portainer shows "timeout" Use Reset Portainer in the launcher, or: Windows reset-portainer.bat / macOS docker compose restart portainer. Then go to localhost:9000 immediately.
Docker is not running Open Docker Desktop, wait for the green whale icon, then run the script again.
localhost:8080 not responding Wait 30 seconds (database starts last) then refresh (F5).
phpMyAdmin connection error MariaDB takes 10-20s to start. Wait and refresh.
[macOS] "Permission denied" chmod +x launcher.command start.command stop.command
[Win] start.bat closes instantly Right-click → "Run as administrator"
Full reset docker compose down -v then run the script again

Tech stack

  • PHP 7.4 — PDO, MySQLi, GD, ZIP, MBString, OPcache
  • Apache 2.4 — mod_rewrite enabled
  • MariaDB 10.6 — 100% MySQL compatible
  • phpMyAdmin 5.2
  • Portainer Community Edition

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors