Fixing POST Content-Length Exceeds Bytes Issue in PHP when Uploading a MySQL Backup with Docker PHPMyAdmin

Tiempo de lectura: < 1 minuto

Here’s the content translated into English and formatted in HTML:
html
Copy code
Reading Time: < 1 minute

Hello, today we are going to solve the problem “Warning: POST ContentLength of X bytes exceeds the limit of X bytes in Unknown on line 0″ that prevents us from uploading .sql copies to our PHPMyAdmin.

In this case, we are using the official PHPMyAdmin image from Docker.

phpmyadmin:
    image: phpmyadmin
    restart: always
    container_name: phpmyadmin_container
    ports:
      - 8081:80
    environment:
      - PMA_ARBITRARY=1
    links:
      - miservicio_mysql:db
    networks:
      - docker-network

To solve this error, we will add the line:

      - UPLOAD_LIMIT=100000000

Inside the environment section, this will create an environment variable to indicate that the limit is 100000000 bytes (we can specify the amount we need or want).

The final container will look like this:

phpmyadmin:
    image: phpmyadmin
    restart: always
    container_name: phpmyadmin_container
    ports:
      - 8081:80
    environment:
      - PMA_ARBITRARY=1
      - UPLOAD_LIMIT=100000000
    links:
      - miservicio_mysql:db
    networks:
      - docker-network

(Note: The “Reading Time” part is not included, and a pipe “” is added at the end as instructed.)

Leave a Comment