Quickly setup your PHP Web Application environment using Docker Compose
- Choose your PHP version (default latest PHP7) Tested on v5.6, v7.0, v7.1, v7.2, v7.3, and v7.4
- Choose between Apache or Nginx as your web server
- Choose your MySQL version (default latest)
Best for testing your PHP web application on a variety of environments.
- Docker Compose https://docs.docker.com/compose/install/
The following will build the latest versions of PHP7, Apache, and MySQL. Once up, you may access your web application at localhost:8080
wget https://github.com/easterncoder/php-app-docker/archive/master.zipunzip master.zipcd php-app-docker-masterexport UID; docker-compose up --build
You may then look at:
- localhost:8080/phpinfo.php
- localhost:8080/adminer.php
- PHP Files (Put your PHP app here):
app/web - MySQL Data (This is where MySQL will store its data):
app/mysql
- HOST: mysql
- USER: root
- PASS: root
docker-compose start/stop
Build options are specified by the following environment variables.
- WEBSERVER
- apache (default)
- nginx
- MYSQLVER
- Any version as listed on https://hub.docker.com/_/mysql?tab=tags
- PHPVER
- 7 (default: will build latest available version of PHP 7)
- 7.4
- 7.3
- 7.2
- 7.1
- 7.0
- 5.6
Examples:
-
Latest versions of PHP7, Nginx and MySQL
export UID; export WEBSERVER=nginx; docker-compose up --build -
PHP5.6, Apache (latest) and MySQL 5.6
export UID; export WEBSERVER=apache; export MYSQLVER=5.6; docker-compose up --build