Launch LAMP services by docker-compose. This environment consists of 3 containers:
- PHP 5.5.29 + APACHE 2.4.10
- MYSQL 5.6.46
- PHPMYADMIN 5.0.0 (image: php 7.4.1; Apache/2.4.38 (Debian))
Purposes of development and test. Not recommended to use in production environment.
$ tree
.
├── db-data
├── docker-compose.yml
├── php5apache
│ └── Dockerfile
└── www
├── connDB.php
└── index.php
db-data
: persistent MySQL DB Data will be here.www
: place your php web code here.
-
git clone
this repository. -
Copy your php web code into directory
www
. -
IMPORTANT!! Modify MySQL Root Password in docker-compose.yml:
MYSQL_ROOT_PASSWORD: root1234
-
(Optional) If you have existing mysql data(
/var/lib/mysql/*
), you can copy them to overwritedb-data/*
. -
Launch LAMP services:
$ cd lamp-stack-docker-compose
$ docker-compose up -d
-
Test:
- Pure PHP: http://127.0.0.1:41001
- DB Connect: http://127.0.0.1:41001/connDB.php
- PhpMyAdmin http://127.0.0.1:41002
-
If you want to terminal LAMP services but keep data:
$ docker-compose down
- Container instances will be removed.
- MySQL data will persist in folder
db-data
.