Skip to content

A production-ready Dockerfile for PHP 8.1 tailored specifically for WordPress or other PHP-based systems. This image includes a wide range of essential PHP extensions and tools like SourceGuardian and ionCube, widely used in the WordPress ecosystem.

License

Notifications You must be signed in to change notification settings

BaseMax/docker-php8.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker-PHP 8.1

Docker License

A production-ready Dockerfile for PHP 8.1 tailored specifically for WordPress or other PHP-based systems. This image includes a wide range of essential PHP extensions and tools like SourceGuardian and ionCube, widely used in the WordPress ecosystem.

Features

  • PHP Version: 8.1 (FPM Alpine)
  • Extensions:
    • Core PHP extensions: bcmath, bz2, calendar, curl, exif, fileinfo, ftp, gd, gettext, imagick, imap, intl, ldap, mbstring, mcrypt, memcached, mongodb, mysqli, opcache, pdo, pdo_mysql, redis, soap, sodium, sysvsem, sysvshm, xmlrpc, xsl, zip
    • Advanced debugging tools: xdebug
    • Profiling support: xhprof
  • PHP Encryption Support:
    • ionCube Loader
    • SourceGuardian
  • Additional Tools:
  • Optimizations:
    • OPCache configuration for performance
  • Base OS: Alpine Linux (lightweight and secure)

Installation

Prerequisites

  • Docker installed on your system.

Pull the Image

Pull the pre-built image from Docker Hub (replace your-dockerhub-repo with your repository, if published):

# Pull the image
docker pull basemax/docker-php8.1

Usage

Basic Usage

Run the container:

docker run -d \
  -v $(pwd):/var/www/html \
  -p 9000:9000 \
  --name php-fpm-basemax \
  basemax/docker-php8.1

Docker Compose Example

Here’s an example docker-compose.yml file for use with this Docker image and Nginx:

services:
  php:
    image: basemax/docker-php8.1
    volumes:
      - .:/var/www/html
    ports:
      - "9000:9000"

  nginx:
    image: nginx:alpine
    volumes:
      - .:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    ports:
      - "8080:80"
    depends_on:
      - php

Start the services:

docker-compose up -d

OPCache Configuration

The Dockerfile includes optimized OPCache settings. If you need to modify them, edit the configuration file located in /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini.

PHP Tools

Composer

Composer is pre-installed and available globally.

composer --version

WP-CLI

WP-CLI is pre-installed for managing WordPress installations.

wp --info

SourceGuardian and ionCube Loader

These popular encryption tools are included and pre-configured.

Example for WordPress Setup

Step 1: Create a docker-compose.yml file

Use the Docker Compose example above and adjust paths as needed.

Step 2: Download WordPress

Download WordPress to your project directory:

curl -O https://wordpress.org/latest.tar.gz

Step 3: Start the Environment

Run the containers:

docker-compose up -d

Access your WordPress site at http://localhost:8080.

Customization

Adding More Extensions

Use the install-php-extensions script to install additional extensions:

RUN install-php-extensions <extension-name>

Changing User Permissions

By default, the www-data user and group IDs are set to 1000 for compatibility with host systems. Adjust as needed:

usermod -u <UID> www-data
groupmod -g <GID> www-data

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Disclaimer

This image is provided as-is without warranty. Please test thoroughly before using in production environments.

License

This project is licensed under the MIT License.

https://github.com/mlocati/docker-php-extension-installer

About

A production-ready Dockerfile for PHP 8.1 tailored specifically for WordPress or other PHP-based systems. This image includes a wide range of essential PHP extensions and tools like SourceGuardian and ionCube, widely used in the WordPress ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published