Phpmyadmin docker max upload size

Setting Maximum Upload Size for phpMyAdmin in Docker

When using phpMyAdmin in Docker, you may need to adjust the maximum file upload size for importing databases or other large files. By default, phpMyAdmin has a limit on the size of files that can be uploaded. Fortunately, this limit can be modified to meet your requirements.

To modify the maximum upload size for phpMyAdmin in Docker, you need to modify the configuration of your Docker container by providing custom settings.

Step 1: Identify the Docker Container for phpMyAdmin

Firstly, you need to identify the container running your phpMyAdmin instance. You can use the following command to list all running containers:

$ docker ps

Find the container ID or name associated with your phpMyAdmin instance. Note it down as it will be used in the next step.

Step 2: Edit the php.ini File

Next, you need to modify the php.ini file inside the Docker container. You can do this by accessing a shell session in the container. Use the following command, replacing [container-id] with the ID or name of your phpMyAdmin container:

$ docker exec -it [container-id] /bin/bash

Once inside the container, navigate to the phpMyAdmin directory:

# cd /etc/phpmyadmin

Open the php.ini file using a text editor:

# vi php.ini

Find the line that starts with upload_max_filesize. By default, it is usually set to 2M (megabytes).

You can increase the value to your desired file size limit. For example, to set the maximum upload size to 100M (megabytes), change the line to:

upload_max_filesize = 100M

Save the changes and exit the text editor.

Step 3: Restart the Docker Container

To apply the changes, you need to restart the Docker container running phpMyAdmin. Use the following command, replacing [container-id] with the ID or name of your phpMyAdmin container:

$ docker restart [container-id]

After the container restarts, the maximum upload size for your phpMyAdmin instance will be updated.

Example

Assuming your phpMyAdmin container is named my-phpmyadmin, you can execute the following commands:

$ docker exec -it my-phpmyadmin /bin/bash
# cd /etc/phpmyadmin
# vi php.ini

Inside the php.ini file, locate the line upload_max_filesize = 2M and change it to upload_max_filesize = 100M. Save the changes and exit the text editor.

# exit
$ docker restart my-phpmyadmin

After restarting the container, the maximum upload size for your phpMyAdmin instance named my-phpmyadmin will be set to 100 megabytes.

Leave a comment