I build up a docker-compose environment with apache, php7.0, mysql and also added phpmyadmin.
I tried so many times to include my own php.ini file and finally, I got to php accept it as it shown in my index.php loaded with phpinfo().
I need to load a database that weights more than 750Mb and my phpmyadmin doesn't let me import databases larger than 512Mb.
I tried to compress the db to 60Mb, but when I try to import it, it takes so long and ends up cutting the import because it took so long, leaving my db incomplete.
Even setting up my php.ini file_size limits and all that, the phpmyadmin ignores it.
This is what I've changed in php.ini:
upload_max_filesize = 1024M
post_max_size = 1024M
memory_limit = 1024M
max_execution_time = 300
My docker-compose.yml is:
version: '3.3'
services:
php:
build: apache-php
ports:
- "80:80"
- "443:443"
volumes:
- ./apache-php/www:/var/www/html
links:
- mysql
- phpmyadmin
mysql:
image: mysql:5.7
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=1347891743
- MYSQL_DATABASE=database
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- "8080:80"
volumes:
- ./mysql:/var/lib/mysql
I also got a Dockerfile to run my php:
FROM php:7.0-apache
RUN docker-php-ext-install mysqli
COPY config/php.ini /usr/local/etc/php/
This is what it shows in phpmyadmin.
A little of help would be very appreciated
You can try:
Config of php.ini
in phpmyadmin container in /usr/local/etc/php/
This is in .yml
phpmyadmin:
volumes:
- ./php-make/upload.ini:/usr/local/etc/php/php.ini
And file upload.ini
upload_max_filesize = 1280M
post_max_size = 1280M
Change any point if you want
I can do and success
Try this: access your phpmyadmin docker container: docker exec -it [container name or is] bash
create a php.ini in /usr/local/etc/php:
nano /usr/local/etc/php/php.ini
(nano or vi, depends in the editor you prefer)
Add the lines you need, as example:
file_uploads = On
memory_limit = 6G
upload_max_filesize = 6G
post_max_size = 6G
max_execution_time = 6000
then reload: service apache2 reload
That worked for me!!
From my experience PhpMyAdmin is not the best way to import big databases. So even if you'll manage to increase memory_limit you'll still encounter long process time.
It would be better to provide init script and link it to /docker-entrypoint-initdb.d folder via docker-compose. For example:
mysql:
image: mysql:5.7
volumes:
- ./my_directory_with_init_scripts:/docker-entrypoint-initdb.d
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=1347891743
- MYSQL_DATABASE=database
From here you may see that it scans /docker-entrypoint-initdb.d folder for sutable file (including *.sql) and processes them. So just put your SQL dump file in linked volume and it's done.
If you still need to increase php memory_limit, then probably you can set PMA specific settings using /etc/phpmyadmin/config.user.inc.php. More information in PMA docs and in PMA docker image readme .
The easy way is use the environment vars.
Inside the phpmyadmin container if you check the php conf files you can see find the file /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
with this content:
allow_url_fopen=Off
max_execution_time=${MAX_EXECUTION_TIME}
max_input_vars=10000
memory_limit=${MEMORY_LIMIT}
post_max_size=${UPLOAD_LIMIT}
upload_max_filesize=${UPLOAD_LIMIT}
So you can override that value simply use environment
Your docker-composer.yml
become
version: '3.3'
services:
php:
build: apache-php
ports:
- "80:80"
- "443:443"
volumes:
- ./apache-php/www:/var/www/html
links:
- mysql
- phpmyadmin
mysql:
image: mysql:5.7
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=1347891743
- MYSQL_DATABASE=database
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- mysql
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
- UPLOAD_LIMIT=1024M
- MEMORY_LIMIT=1024M
- MAX_EXECUTION_TIME=300
ports:
- "8080:80"
volumes:
- ./mysql:/var/lib/mysql
is the same running the docker command:
docker run -e VARIABLE=VALUE ...
You can config file "phpmyadmin-misc.ini" in docker container
docker inspect phpmyadmin
"MergedDir": "/var/lib/docker/overlay2/e703e63ddf58c0decebd292eabaf8fe2c7eef49eafa390d7f7cc971f523fb0a8/merged",
Edit file
Add 2 lines
upload_max_filesize = 1024M
post_max_size = 1024M
docker restart phpmyadmin
You can pass the UPLOAD_LIMIT parameter into your docker run command. The phpMyAdmin container sets the default to 2mb.
You can check it on the official documentation: https://hub.docker.com/_/phpmyadmin
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.