Some WordPress plugins or themes require a custom PHP environment to function smoothly. If you are using docker-compose
as your primary orchestration tool, you’ll need a custom Dockerfile
and to mount a custom.ini
file into the image.
Follow these steps.
services:
wordpress:
build: .
restart: always
ports:
- 80:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wp
WORDPRESS_DB_PASSWORD: secret
WORDPRESS_DB_NAME: wp
volumes:
- .:/var/www/html
db:
# Adjust the version from https://hub.docker.com/_/mariadb
image: mariadb:11.6
restart: always
environment:
MARIADB_DATABASE: wp
MARIADB_USER: wp
MARIADB_PASSWORD: secret
MARIADB_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
db:
# Adjust the version from https://hub.docker.com/_/wordpress
FROM wordpress:6.7.1-php8.3-apache
COPY custom.ini $PHP_INI_DIR/conf.d/
max_execution_time = 180
max_input_vars = 5000
Finally, start all the services by running:
docker compose up -d
Your PHP environment will now load the custom PHP settings.
Feel free to checkout the code at Github.