How to Set PHP Options for Wordpress in Docker Compose
Create a new file named wordpress.ini and and enter the following entries in it:
file_uploads = On
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 1000
In the Wordpress docker-compose.yml file, mount the file as a volume as follows:
version: '2'
services:
wordpress:
depends_on:
- db
image: wordpress:5.5.0-php7.2-apache
ports:
- "8080:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: P@ssw0rd2
volumes:
- ./wordpress.ini:/usr/local/etc/php/conf.d/wordpress.ini
volumes:
db_data:
Restart the wordpress container:
docker-compose down && docker-compose up -d