Changing common PHP settings

Instead of going through the effort of writing custom scripts or mounting files to change PHP settings, have the power to change common settings with the simplicity of an environment variable.

Common Examples

All our environment variables are documented and can be found in our environment variable specification documentation.

Here are a few examples on how you can change common PHP settings.

Docker Compose: Changing allowed upload size

version: '3'
services:
  php:
    image: serversideup/php:8.2.12-unit-bookworm
    environment:
      PHP_POST_MAX_SIZE: "500M"
      PHP_UPLOAD_MAX_FILE_SIZE: "500M"
      SSL_MODE: "mixed"
    ports:
      - 80:80
      - 443:443
    volumes:
      - .:/var/www/html/

Docker CLI: Setting the PHP timezone to New York

docker run -d \
  -p 80:80 \
  -v $(pwd):/var/www/html \
  -e PHP_DATE_TIMEZONE="America/New_York" \
  serversideup/php:8.2.12-fpm-nginx-bookworm

Setting your own php.ini

Validating changes

It's always best to validate your changes by running php -i via the command line or using phpinfo().