This project provides a collection of optimized Docker images to run PHP applications in various scenarios.
With a focus on flexibility and performance, the images are organized into categories that cater to everything from command-line tools to full development and production stacks.
Each image is carefully maintained and regularly updated to ensure compatibility and security.
For more technical information, please visit our DeepWiki Page (AI generated).
This project is designed for developers, system administrators, and DevOps engineers who need a reliable and efficient way to run PHP applications in Docker containers.
Whether you're building a new application, maintaining an existing one, or looking to streamline your development workflow, these images provide the tools and flexibility you need.
My name is Felipe Braz, I am a DevOps engineer and System Administrator with a passion for open-source software and Docker.
Although my career has taken me in directions away from PHP, I still hold a deep passion for the language that introduced me to the world of technology and software development.
I believe in the power of collaboration and open-source software, and I hope this project can help you in your development journey.
A variety of tools images to help you manage your PHP applications:
- PHP CLI: Command line interface for PHP applications, with Phalcon framework support.
- PHP Composer: Command line for Composer package manager.
- WP-CLI: Manage WordPress installations with this Command line Tool.
- Symfony CLI: Command line for Symfony framework.
# Run a standalone PHP script
docker run -it --rm fbraz3/php-cli:latest php myscript.php
# Run a PHP built-in server with Phalcon framework support
docker run -it --rm -v $(pwd):/workspace -p 8000:8000 fbraz3/php-cli:latest-phalcon php -S localhost:8000
# Install a fresh wordpress using wp-cli
docker run -it --rm -v $(pwd):/workspace fbraz3/wp-cli:latest core download --path=/workspace
# Install a fresh symfony using symfony-cli
docker run -it --rm -v $(pwd):/workspace fbraz3/symfony-cli:latest new my_project_name
Images focusing on PHP server backend for easy integration with most commons web servers:
- PHP-FPM: PHP FastCGI Process Manager, designed to work with a separate web server, such as Nginx or Apache2.
Step 1: Run PHP-FPM image and expose port 1780/TCP
# Run a PHP-FPM server, php-fpm socket will listening on port 1780
docker run -it --rm --name=php-fpm -p 1780:1780 -v $(pwd):/app/public fbraz3/php-fpm:latest php-fpm
Step 2: Configure your webserver to handle fastcgi from 1780 port
- Example for NGINX
server {
listen 80 default_server;
root /app/public;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:1780;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 300;
}
}
- Example for Apache2 / HTTPD
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /app/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DirectoryIndex index.php index.html index.htm
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:1780"
</FilesMatch>
<Directory /app/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Images providing PHP and built-in web server for easy deployment:
- PHP-FPM with Apache2: PHP-FPM image, including a built-in Apache2 web server.
- PHP-FPM with Nginx: PHP-FPM image, including a built-in Nginx web server.
# Run a PHP-FPM server with Apache2, php-fpm socket will listening on port 80
docker run -it --rm --name=php-apache2 -p 80:80 -v $(pwd):/app/public fbraz3/php-apache2:latest php-fpm
# Run a PHP-FPM server with Nginx, php-fpm socket will listening on port 80
docker run -it --rm --name=php-nginx -p 80:80 -v $(pwd):/app/public fbraz3/php-nginx:latest php-fpm
Images providing a complete stack for your development environment:
- LEMP: Classic LNMP/LEMP image, with Linux, Nginx, MySQL and PHP, plus with PHPMyAdmin.
- LAMP: Classic LAMP image, with Linux, Apache2, MySQL and PHP, plus with PHPMyAdmin.
# Run a LEMP server, php-fpm socket will listening on port 80
docker run -it --rm --name=lnmp -p 80:80 -v $(pwd):/app/public fbraz3/lnmp:latest php-fpm
# Run a LAMP server, php-fpm socket will listening on port 80
docker run -it --rm --name=lamp -p 80:80 -v $(pwd):/app/public fbraz3/lamp:latest php-fpm
Cronjobs can be configured by binding a file to /cronfile
in the container.
The system will automatically install and execute the jobs.
For more details, see the php-fpm-docker documentation.
- Compatibility with the following images:
To enable email sending, this image relies on the configuration provided in the php-base-docker
project.
Follow the instructions in the php-base-docker documentation to set up email functionality.
- Compatibility with all images in this project.
Some images allow you to customize PHP directives using environment variables.
For detailed instructions, refer to the php-fpm-docker documentation.
- Compatibility with the following images:
Here's a summary of the images available in this project:
Image | Build Schedule | Build Status |
---|---|---|
php-cli | Every Sunday, 6:00 AM UTC | |
phalcon | Every Sunday, 7:00 AM UTC | |
php-composer | Every Sunday, 7:15 AM UTC | |
wp-cli | Every Sunday, 7:30 AM UTC | |
symfony-cli | Every Sunday, 7:40 AM UTC | |
php-fpm | Every Monday, 6:00 AM UTC | |
php-nginx | Every Tuesday, 6:00 AM UTC | |
php-apache2 | Every Tuesday, 9:00 AM UTC | |
lemp/lnmp | Every Wednesday, 6:00 AM UTC | |
lamp | Every Wednesday, 9:00 AM UTC |
Maintaining this project requires significant time and effort. If you find it valuable, please consider supporting its development through a donation: