fbraz3/php-system-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

  1. Who is this for?
  2. About the author
  3. Available Images
  4. Features
  5. Build Status
  6. Donation

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:

# 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

You may want to add these executable aliases to your .bashrc or .zshrc for convenience.

PHP_VERSION=8.4 # Replace with your preferred PHP version
php() { docker run -v "$(pwd):/workspace" --rm fbraz3/php-cli:$PHP_VERSION "$@"; }
composer() { docker run -v "$(pwd):/workspace" --rm fbraz3/php-composer:$PHP_VERSION "$@"; }
wp() { docker run -v "$(pwd):/workspace" --rm fbraz3/wp-cli:$PHP_VERSION "$@"; }
symfony() { docker run -v "$(pwd):/workspace" --rm fbraz3/symfony-cli:$PHP_VERSION "$@"; }

fbraz3/php-base-docker

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>

fbraz3/php-fpm-docker

Images providing PHP and built-in web server for easy deployment:

# 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.

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.

Here's a summary of the images available in this project:

ImageBuild ScheduleBuild Status
php-cliEvery Sunday, 6:00 AM UTCBase Images
phalconEvery Sunday, 7:00 AM UTCPhalcon Images
php-composerEvery Sunday, 7:15 AM UTCBuild Composer Images
wp-cliEvery Sunday, 7:30 AM UTCWP-Cli Images
symfony-cliEvery Sunday, 7:40 AM UTCSymfony Images
php-fpmEvery Monday, 6:00 AM UTCBuild Base ImagesBuild Phalcon Images
php-nginxEvery Tuesday, 6:00 AM UTCBuild Base ImagesBuild Phalcon Images
php-apache2Every Tuesday, 9:00 AM UTCBuild Base ImagesBuild Phalcon Images
lemp/lnmpEvery Wednesday, 6:00 AM UTCBuild Base ImagesBuild Phalcon Images
lampEvery Wednesday, 9:00 AM UTCBuild Base ImagesBuild Phalcon Images

Maintaining this project requires significant time and effort. If you find it valuable, please consider supporting its development through a donation:

Sponsor this project

  •