Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to support changing the upload file size limit #375

Closed
adriatic opened this issue Feb 13, 2019 · 5 comments
Closed

How to support changing the upload file size limit #375

adriatic opened this issue Feb 13, 2019 · 5 comments
Labels

Comments

@adriatic
Copy link

@adriatic adriatic commented Feb 13, 2019

I am proposing to expose the /usr/local/etc/php directory one can do a bind mount and specify overrides.

This proposal comes as a summary of the discussion at https://forums.docker.com/t/how-to-get-access-to-php-ini-file/68986?u=monterey, trying to define the simplest method for solving the error condition The uploaded file exceeds the upload_max_filesize directive in php.ini

@gforghetti

This comment has been minimized.

Copy link

@gforghetti gforghetti commented Feb 13, 2019

This also will also users to specify a custom php.ini file at container run time.

@wglambert wglambert added the Request label Feb 13, 2019
@wglambert

This comment has been minimized.

Copy link

@wglambert wglambert commented Feb 13, 2019

Traditionally users would mount a custom.ini in the $PHP_INI_DIR/conf.d/, it looks like the WordPress documentation doesn't direct users to the php docs for information on configuring the image.

There was also this previous discussion on changing the upload file size limit #10 (comment)

@wglambert

This comment has been minimized.

Copy link

@wglambert wglambert commented Feb 13, 2019

uploads.ini

file_uploads = On
upload_max_filesize = 256M
post_max_size = 256M

docker-compose.yml

version: '3.6'

services:
  mysql:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123
      MYSQL_DATABASE: db
      MYSQL_USER: user
      MYSQL_PASSWORD: 123

  wordpress:
    image: wordpress:latest
    container_name: wordpress
    volumes:
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: mysql:3306
      WORDPRESS_DB_NAME: db
      WORDPRESS_DB_USER: user
      WORDPRESS_DB_PASSWORD: 123

Checking the changes

$ docker-compose up -d
Creating network "wordpress-375_default" with the default driver
Creating wordpress ... done
Creating mysql     ... done

$ docker exec wordpress php -i | grep upload
/usr/local/etc/php/conf.d/uploads.ini
file_uploads => On => On
max_file_uploads => 20 => 20
upload_max_filesize => 256M => 256M
. . .
@tianon

This comment has been minimized.

Copy link
Member

@tianon tianon commented Feb 20, 2019

Indeed, as @wglambert mentions (and shows), the officially supported way to adjust this value in this image is the same as the way to do so on any PHP install, namely adjusting php.ini through any of the various methods PHP provides to do so (which is out of scope for us to document).

@tianon tianon closed this Feb 20, 2019
@adriatic

This comment has been minimized.

Copy link
Author

@adriatic adriatic commented Feb 21, 2019

Happy to see that this is successfully closed with the solution that is "WordPress standard" (read: I did not want to just patch it any way that I could think of, but tried instead to keep the issue alive until it gets proper cure 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.