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
Increase PHP file upload limit #10
Comments
As much as I dislike running into php's file upload limits, I am not sure that we want to change from the default coming from apache and php. We could add an example for changing this and other php.ini related variables. /cc @tianon thoughts? |
Yeah, I'm also wary of this, especially since Docker doesn't actually have explicit container quota support (which would be a whole different story, but still only half the story). This might be something that's changed often enough that it warrants an environment variable for custom tweaking, but I'm +1 on keeping the default as untouched from upstream. |
When you change the value of this in php.ini, isn't there some Wordpress setting you have to tweak to get it to actually pick it up correctly, or has that been fixed? |
@tianon Not that I'd know, didn't have to do anything on my instances. |
docker run --name dev-wordpress --link dev-mysql:mysql -v ~/wordpressDof/config/php.ini:/etc/php5/apache2/php.ini -p 80:80 -d wordpress |
@Nxir |
Found something that seems to work for me. I've created an uploads.ini file with the following contents:
Then I added the ini to the appropriate conf.d path I found in the phpinfo (/usr/local/etc/php/conf.d/):
My wordpress upload limit is sitting at 64M now which is plenty for what I need. Hope this helps someone else. |
There isn't a default php.ini file created with the base image that is used for wordpress. A) Add the following 2 lines to your wordpress Dockerfile:
However, on the docker registry page they recommend adding a custom php.ini to B) Set the limits with your .htaccess file thats in your wordpress data directory.
|
just like @dbxt says, create
use
|
I think it is clear that this is not an issue with the image. The image should be as close as possible to the defaults. For specific configuration, please mount your configuration or create your own image based on this one. Can we close the issue now? Thanks! |
A session variable would be helpful, as mounting local volumes is not portable from one host to another. @darwingr I'm interested in the .htaccess method, how would you go about that using a WP data container? |
@JulianKingman you can use fig (docker-compose) as clonn did above |
+1 for creating an environment variable for configuring this. All volume-related options are only suitable for local development. Or, even better, there could be a script that will parse |
If you are running into this issue, I've created a docker file with the uploads.ini file specified above that is available here: https://hub.docker.com/r/mattjonestechnology/wordpress/. This has worked well with me deployed to a Kubernetes cluster. |
@clonn answer should have a special spot on the README.md (IMHO) |
direct on dockerfile
|
How would this be done in docker-compose.yml? I am in support of setting this at run-time using an environment variable. |
@Chaz6 just like this services:
db:
image: mariadb:10.1
command: mysqld --innodb-buffer-pool-size=64M
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
depends_on:
- db
ports:
- '80:80'
- '443:443'
volumes:
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- ./my-wordpress-theme:/var/www/html/wp-content/themes/my-wordpress-theme |
@dbxt why did you attached
|
Hey @m-pawelczyk - it seems you confused the purpose of that mount. Docker can mount a single file to a container too, this is not a directory. It is not needed to change the PHP settings, but useful to test them (via |
Hi, I just created an image with the configuration from @juanpablocs, you can find it here: nebuchar/wordpress-unlimited |
@vyscond I added that to my docker-compose.yml but when I look at media add new upload it still says: Any reason why? do i need to restart wordpress/docker? |
If those don't work, post |
@stcalica post:
|
Thank you! Please add this to the readme. |
For those of us who just desire a straight answer. Can anyone of the experts provide a simple answer. How to increase the upload size in php.ini? |
@tremy0207 You basically need to override the following file
services:
db:
image: mariadb:10.1
command: mysqld --innodb-buffer-pool-size=64M
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
depends_on:
- db
ports:
- '80:80'
- '443:443'
volumes:
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini # <- right here, boi!!!
- ./my-wordpress-theme:/var/www/html/wp-content/themes/my-wordpress-theme Notes If you're working on a docker-composer environment please do not forget to rebuild you container after your edit: |
Thanks for your suggestion. However, I am new to Docker. Can you provide this information for a novice? Thanks |
@tremy0207 老哥,你想咋整啊? |
Can you move the support/chatter someplace else? Thanks. |
I refactored the official example from https://docs.docker.com/compose/wordpress/ to allow for easy configuration of a Have a look here: https://github.com/FroeMic/Docker-Compose-Wordpress I hope it helps! |
I am using this image via kitematic . How can I increase the upload size using kitematic? Also if we increase the size via a local file so when we want to publish from local workstation to production we have to copy all these configs too. Is there any better solutions? For example some environment variables? or I think using "RUN echo ..." command is better that adding a volume for upload.ini but I do not know how can I run this command using kitematic. Does someone have any idea? |
To persist your changes, create a short FROM wordpress:php7.2-apache
COPY uploads.ini /usr/local/etc/php/conf.d/ |
Closing given that this is fairly well-discussed and we lack an official recommendation from WordPress upstream on what an appropriate value for this setting should be (and the current value is the default coming directly from PHP upstream). |
Thank You <3 |
Check the thread Increase PHP file upload limit, for the continuation of this discussion. There is a solution in the form of the YAML file for the composer here. |
How are you supposed to change to Every time I try mapping a file containing this configuration like this:
I get an error saying:
|
@sadesarrollo that setting is "per-pool", so you want your file to start with In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. |
If you're going to run on docker, the last thing you should be concerned with is too big files being uploaded.
The text was updated successfully, but these errors were encountered: