PHP User
PHP User

Reputation: 2422

How to override upload_max_filesize in php.ini in docker image

I have this docker-compose.yml (part of the main file)

services:
my-site:
  build:
    context: .
    dockerfile: Dockerfile
  container_name: my-site
  environment:
    VIRTUAL_HOST: my-site.local
    PHP_INI_SCAN_DIR: "/usr/local/etc/php/custom.d:/usr/local/etc/php/conf.d"
    TZ: Europe/Paris
  ports:
    - "9090:80"
  volumes:
    - ./../myapp:/var/www/my-site
    - ./app/config/custom.php.ini:/usr/local/etc/php/custom.d
phpmyadmin:
   image: phpmyadmin/phpmyadmin
   container_name: phpmyadmin
   hostname: phpmyadmin.local
   ports :
      - "8080:80"
   environment:
      - PMA_HOST=mysql
      - PMA_USER=root
      - PMA_PASSWORD=password
   links:
      - mysql:mysql
   volumes:
      - ./app/config/php.ini:/usr/local/etc/php/php.ini

In webapp cli

enter image description here

In phpmyadmin cli

enter image description here

Though it's the same file but it doesn't load it

And can't upload a database more than 2MB

enter image description here

How can I change this value upload_max_filesize and post_max_size in php.ini in docker image

Upvotes: 11

Views: 38971

Answers (1)

Konstantin Bogomolov
Konstantin Bogomolov

Reputation: 1366

Use UPLOAD_LIMIT env variable. Documentation

UPLOAD_LIMIT - if set, will override the default value for apache and php-fpm (format as [0-9+](K,M,G) default value is 2048K, this will change upload_max_filesize and post_max_size values)

Example:

phpmyadmin:
  image: phpmyadmin/phpmyadmin
   container_name: phpmyadmin
   hostname: phpmyadmin.local
   ports:
     - "8080:80"
   environment:
     PMA_HOST: mysql
     PMA_USER: root
     PMA_PASSWORD: password
     UPLOAD_LIMIT: 64M

Upvotes: 40

Related Questions