This is a XAMPP-like environment that can be built by docker-compose. Tested on Ubuntu 18.04.
- docker: https://docs.docker.com/engine/install/ubuntu/
- docker-compose: https://docs.docker.com/compose/install/
Start docker service.
$ sudo service docker start
Execute the following command in the directory where docker-compose.yml
is located.
$ docker-compose build
Place your files on htdocs
.
※ When using Database in your PHP program, describe as follows.
........
$dsn = 'mysql:dbname='.$DBNAME.';host=mysql-container;charset=utf-8';
$user = 'root';
$password = 'password';
$dbh = new PDO($dsn, $user, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
........
$ docker-compose up -d
To access phpMyAdmin, go to http://localhost:8080
on your browser.
$ docker-compose down