How To Increase post_max_size In An Adminer Docker Container

No Comments
Published: 31.03.2024

Do you need to increase the post_max_size in your adminer docker container, for example, to import a bigger SQL file? In this super short guide, I will show you how I achieved it.

Increase post_max_size in an adminer docker container

Before we can start, let’s set up a basic adminer container so that we start on the same basis. In this post, I will use docker-compose, and then I can create it like this:

Server icon

VPS Hosting Course

Learn everything you need to know about servers and hosting your own applications!
adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

With this, we get the following error when trying to import a big SQL file, for example, when filling a database with test data:

Too big POST data. Reduce the data or increase the "post_max_size" configuration directive.

To fix this problem, we need to start the container by overwriting the startup command. For this, we can use the command property in docker-compose, and in the command, we need to overwrite both the post_max_size and the upload_max_size by using the -d flag. (Sometimes, it is also needed to increase the memory_limit. For me, this was not the case, but if the following does not work for you, maybe check this answer here)

Our container definition will now look as follows:

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
    command: ["php", "-d", "post_max_size=500M", "-d", "upload_max_filesize=500M", "-S", "0.0.0.0:8080", "-t", "/var/www/html"]

And with that you are now able to import files with up to 500M. If you need more, you can adjust it to whatever you need.

Need help or want to share feedback? Join my discord community!

Conclusion

With this quick guide, you are now able to import bigger SQL files to the adminer because you used the Docker command to overwrite the post_max_size and upload_max_filesize.

I hope this guide was helpful to you, and if you have any questions, feel free to ask!
And if you enjoyed this guide consider subscribing to my newsletter!

KOFI Logo

If this guide is helpful to you and you like what I do, please support me with a coffee!

Discussion (0)

Add Comment

Your email address will not be published. Required fields are marked *