try.directtry.direct

Back to explains list

How to change max_upload_size in php.ini when running Docker

This example demonstrates how to change upload_max_filesize for OroCommerce. These instructions are specifically tailored for TryDirect deployments.


The directory containing the configuration files and docker-compose.yml is usually located at /root/app-name.



1. Modify PHP Configuration (php.ini):

• Open the PHP configuration file located at /root/orocommerce/configs/php/php.ini.

• Update the following directives to set the desired maximum file upload size:


upload_max_filesize = 10M
post_max_size = 12M

bash


Explanation:

upload_max_filesize: This directive defines the maximum size of a single file that can be uploaded. In this example, it is set to 10MB.

post_max_size: This directive sets the maximum size of all POST data, including file uploads and other form data. It should be slightly larger than upload_max_filesize to accommodate additional form data. In this example, it is set to 12MB.


2. Restart Docker Containers:

• Navigate to the directory containing your docker-compose.yml file. Typically, this is the root directory of your project.

• Restart the specific containers to apply the new configuration. Use the following commands:


docker compose restart orocommerce 
docker compose restart orocommerce-websocket
docker compose restart orocommerce-message-consumer

3. Verify the Changes:

You can check the current PHP settings by entering the container and using the php -i command.

1. Access the PHP and OroCommerce container by using the following command:


docker exec -it orocommerce sh

bash

2. Execute the following command inside the container:


php -i | grep 'upload_max_filesize\|post_max_size'

bash


This command will display the values of the upload_max_filesize and post_max_size directives.

Next article: Single Sign-On post configuration steps