Docker 上的 PHPMyAdmin with Laravel Sail POST Content-Length 超出了限制
PHPMyAdmin on Docker with Laravel Sail POST Content-Length exceeds the limit
我在 Docker 上有一个 Laravel 环境 运行,通过 Mac OS X Big Sur 上的 Sail。我在我的 docker-compose.yml 文件中添加了一个 phpmyadmin 并且一切正常,但是当我尝试将我的数据导入数据库时,我得到:
Warning: POST Content-Length of 68109047 bytes exceeds the limit of 2097152 bytes in Unknown on line 0
我将 docker 配置文件发布到我的 Laravel 项目并重新启动 docker。这是我的 docker-composer.yml:
version: '3'
services:
laravel.test:
build:
context: ./docker/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
myadmin:
image: 'phpmyadmin:latest'
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
links:
- "mysql:db"
depends_on:
- mysql
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local
并在 docker/8.1/php.ini
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
但还是没有运气。我还尝试了 运行 这个命令,然后在提示符下:
sail php -a
phpinfo();
这表明:
Configuration File (php.ini) Path => /etc/php/8.1/cli
Loaded Configuration File => /etc/php/8.1/cli/php.ini
但是我的 /etc 文件夹中没有 php 文件夹。我还在 docker/8.1/Dockerfile
的 docker 配置中注意到了这一点
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
但还是没有/etc/php文件夹
根据 https://hub.docker.com/_/phpmyadmin,您需要在 docker-compose.yml 文件中将环境变量 UPLOAD_LIMIT 指定为您想要的限制。例如
myadmin:
image: 'phpmyadmin:latest'
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
UPLOAD_LIMIT: 100000
links:
- "mysql:db"
depends_on:
- mysql
networks:
- sail
以便上传限制为 100000kb。
我在 Docker 上有一个 Laravel 环境 运行,通过 Mac OS X Big Sur 上的 Sail。我在我的 docker-compose.yml 文件中添加了一个 phpmyadmin 并且一切正常,但是当我尝试将我的数据导入数据库时,我得到:
Warning: POST Content-Length of 68109047 bytes exceeds the limit of 2097152 bytes in Unknown on line 0
我将 docker 配置文件发布到我的 Laravel 项目并重新启动 docker。这是我的 docker-composer.yml:
version: '3'
services:
laravel.test:
build:
context: ./docker/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
myadmin:
image: 'phpmyadmin:latest'
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
links:
- "mysql:db"
depends_on:
- mysql
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local
并在 docker/8.1/php.ini
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
但还是没有运气。我还尝试了 运行 这个命令,然后在提示符下:
sail php -a
phpinfo();
这表明:
Configuration File (php.ini) Path => /etc/php/8.1/cli
Loaded Configuration File => /etc/php/8.1/cli/php.ini
但是我的 /etc 文件夹中没有 php 文件夹。我还在 docker/8.1/Dockerfile
的 docker 配置中注意到了这一点COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
但还是没有/etc/php文件夹
根据 https://hub.docker.com/_/phpmyadmin,您需要在 docker-compose.yml 文件中将环境变量 UPLOAD_LIMIT 指定为您想要的限制。例如
myadmin:
image: 'phpmyadmin:latest'
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
UPLOAD_LIMIT: 100000
links:
- "mysql:db"
depends_on:
- mysql
networks:
- sail
以便上传限制为 100000kb。