This repo is a modified version of sprintcube's docker-compose-lamp repo. It has been slimed down slightly and configured for development work at Caboodle Tech Inc. Changes to PHP and Apache where heavily inspired by Chialab's docker-php/7.4 repo.
This is a basic LAMP stack environment built using Docker Compose. It consists of the following:
- PHP 8.3
- GD with WebP, JPEG, and Freetype support enabled
- ImageMagick with custom build for PHP 8.3 compatibility
- Xdebug 3.x for debugging
- Redis extension enabled. If you want Redis you will need to add all the other configurations from sprintcube's docker-compose-lamp repo
- Apache 2.4.x
- SSL support enabled
- Customizable
DocumentRoot
via environment variables
- MySQL 8.x
- Configurable initialization scripts and data directories
- Compatible with
mysql_native_password
authentication for legacy support
- phpMyAdmin
- Accessible via configured ports (default
8080
for HTTP,8443
for HTTPS) - Custom upload and memory limits
- Accessible via configured ports (default
Clone this repository on your local computer and run the docker-compose up -d
command:
git clone https://github.com/caboodle-tech/docker-lamp.git
cd docker-lamp/
git fetch --all
cp sample.env .env
docker compose build --pull --no-cache
docker compose up -d
Your LAMP stack is now ready! You can access it via http://localhost
.*
*LINUX: If your on a linux / unix operating system you will need to open the projects root directory and run the following commands to fix file permission issues. These commands assume you setup docker correctly by adding your user to the docker
group and that your host machine has the www-data
group with an id of 33 (common default):
sudo chown -R 33 www
sudo chgrp -R docker www
sudo chmod -R g+w www
# Optional but ok for development only
sudo chmod -R 755 www
This package comes with default configuration options. You can modify them by creating your own .env
file in your root directory.
There are following configuration variables available and you can customize them by overwriting in your own .env
file.
DOCUMENT_ROOT
It is a document root for Apache server. The default value for this is ./www
. All your sites will go here and will be synced automatically.
MYSQL_DATA_DIR
This is MySQL data directory. The default value for this is ./data/mysql
. All your MySQL data files will be stored here.
VHOSTS_DIR
This is for virtual hosts. The default value for this is ./config/vhosts
. You can place your virtual hosts conf files here.
Make sure you add an entry to your system's
hosts
file for each virtual host.
APACHE_LOG_DIR
This will be used to store Apache logs. The default value for this is ./logs/apache2
.
MYSQL_LOG_DIR
This will be used to store Apache logs. The default value for this is ./logs/mysql
.
Apache is configured to run on port 80. So, you can access it via http://localhost
.
By default following modules are enabled.
- rewrite
- headers
If you want to enable more modules, just update
./bin/webserver/Dockerfile
. You have to rebuild the docker image by runningdocker-compose build
and restart the docker containers.
You can connect to web server using docker-compose exec
command to perform various operation on it. Use below command to login to container via ssh.
docker-compose exec webserver bash
The configuration variables for the MySQL database can be customized by overwriting them in your .env
file.
NOTE: The original repo this docker image came from — sprintcube's docker-compose-lamp repo — allowed switching databases and versions. This functionality was removed to reduce the image size. If you would like to try this out please visit their repo.
The installed version of PHP is 8.3.x
By default following extensions are installed.
- curl
- gd
- iconv
- intl
- json
- mbstring
- mcrypt
- mysqli
- webp
- xml
- xmlrpc
- zip
If you want to install more extension, just update
./bin/webserver/Dockerfile
. You have to rebuild the docker image by runningdocker-compose build
and restart the docker containers.
phpMyAdmin is configured to run on port 8080. Use following default credentials.
http://localhost:8080/
username: root
password: lamp
NOTE: On the first run of your local copy you should login to phpMyAdmin as root and complete the installation of the PMA tables. There will be a prompt in a message box on the bottom of the dashboard. Click this and follow the steps.