phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
675 stars 455 forks source link

Wrong container config file location #376

Closed binarweb closed 2 years ago

binarweb commented 2 years ago

The custom configuration is said to be placed under /etc/phpmyadmin/config.user.inc.php.

By placing a file at the specified location with something like this in it:

<?php
echo "I'm here!";
exit;

will never load that file.

The actual file location in the container is specified in /var/www/html/libraries/vendor_config.php and it is /etc/phpmyadmin/config.inc.php.

williamdes commented 2 years ago

I think this is because you did forget the php open tag <?php as a first line What is your docker compose file?

binarweb commented 2 years ago

The php tags where there. I edited the issue.

version: "3"
services:
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: project_phpmyadmin
    ports:
      - 8081:80
    environment:
      PMA_HOST: project_mysql_database
      PMA_PORT: 3307
      PMA_ARBITRARY: 1
      MAX_EXECUTION_TIME: 600
      MEMORY_LIMIT: 512M
      UPLOAD_LIMIT: 2048M
      HIDE_PHP_VERSION: true
    volumes:
      - ./config.inc.php:/etc/phpmyadmin/config.inc.php
    restart: always
    mem_limit: 512m
networks:
  default:
    name: project_2022

Note: The container is connecting to another mysql container on port 3307.

williamdes commented 2 years ago

First I would recommend you to use the Docker official repository (see #363):

- image: phpmyadmin/phpmyadmin
+ image: phpmyadmin

As it is said in https://github.com/phpmyadmin/docker#adding-custom-configuration it is in /etc/phpmyadmin/config.user.inc.php and you did use /etc/phpmyadmin/config.inc.php So you would need to change

- - ./config.inc.php:/etc/phpmyadmin/config.inc.php
+ - ./config.inc.php:/etc/phpmyadmin/config.user.inc.php

Could you try again with such changes ?

binarweb commented 2 years ago

@williamdes It seems that you wondered off my original post.

I didn't had a problem with running the container. The container is running just fine.

It was just that the custom configuration file path was wrong in the README.md of this repo.

The original config.user.inc.php should be changed with config.inc.php in the README.md of this repo, as the config.user.inc.php file will never be loaded.

williamdes commented 2 years ago

The original config.user.inc.php should be changed with config.inc.php in the README.md of this repo, as the config.user.inc.php file will never be loaded.

I really do not understand, it is loaded and we have tests for that: https://github.com/phpmyadmin/docker/blob/918d2639a98da3ecc95eb86d6fffc5e5198f8fb6/testing/docker-compose/docker-compose.testing-one-host.yml#L30

binarweb commented 2 years ago

By loading config.user.inc.php as a volume, I'm unable to reproduce the error.

I think my error appeared because I started a container without volumes and then created a /etc/phpmyadmin/config.user.inc.php and tested it like that. And it didn't worked. I don't remember the exact steps I took.

Anyway, thanks for the help! My issue is invalid.