Search code examples
dockerphpmyadminconfiglaradock

Where is the phpMyAdmin config file on a Laradock/Docker installation?


I have successfully installed Laradock/Docker (latest version) as well as phpMyAdmin on Mac Monterey. Everything finally works smoothly, but I can not find the config file of phpMyAdmin to add external web servers.

On previous installations (not Laradock), the file phpmyadmin.config.inc.php was in usr/local/etc.

I tried to put the file there with an echo/exit command there but nothing happens. I also tried to put the file in the laradock/phpMyAdmin folder... same result.

What is the solution to add external servers in a config file for phpMyAdmin?

EDIT ++++

The file laradock/phpmyadmin/config.user.inc.php/phpmyadmin.config.inc.php was created by Docker.

Here is the volume in docker-compose.yml

phpmyadmin:
  build: ./phpmyadmin
  environment:
    - PMA_ARBITRARY=1
    - MYSQL_USER=${PMA_USER}
    - MYSQL_PASSWORD=${PMA_PASSWORD}
    - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
    - MAX_EXECUTION_TIME=${PMA_MAX_EXECUTION_TIME}
    - MEMORY_LIMIT=${PMA_MEMORY_LIMIT}
    - UPLOAD_LIMIT=${PMA_UPLOAD_LIMIT}
  ports:
    - "${PMA_PORT}:80"
  volumes:
    - ./phpmyadmin/config.user.inc.php/phpmyadmin.config.inc.php:/etc/phpmyadmin/config.user.inc.php
  depends_on:
    - "${PMA_DB_ENGINE}"
  networks:
    - frontend
    - backend

Solution

  • Solution:

    • make sure, that your docker containers are not running: docker-compose down -v
    • go to your laradock/phpmyadmin directory, you will probably see a directory called `config.user.inc.php, go there
    • you will probably see a directory called phpmyadmin.config.user.inc.php delete that directory after making sure you have a backup of your config file The directory should look like this screenshot phpmyadmin settings (before changes) And one more screenshot from the code editor: directory-settings-phpmyadmin

    I've tested this setup with the following in the docker-compose file:

    phpmyadmin:
      build: ./phpmyadmin
      environment:
        - PMA_ARBITRARY=1
        - MYSQL_USER=${PMA_USER}
        - MYSQL_PASSWORD=${PMA_PASSWORD}
        - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
        - MAX_EXECUTION_TIME=${PMA_MAX_EXECUTION_TIME}
        - MEMORY_LIMIT=${PMA_MEMORY_LIMIT}
        - UPLOAD_LIMIT=${PMA_UPLOAD_LIMIT}
      ports:
        - "${PMA_PORT}:80"
      volumes:
        - ./phpmyadmin/config.user.inc.php/phpmyadmin.config.inc.php:/etc/phpmyadmin/config.user.inc.php
      depends_on:
        - "${PMA_DB_ENGINE}"
      networks:
        - frontend
        - backend
    

    and yes, that's exactly the same as your last updated docker-compose example in your original question

    The thing I tested in my phpmyadmin.config.inc.php was, to change the $cfg['MaxRows'] = 100; and it worked.

    Advised changes and explanation

    • of course, take your containers down again: docker-compose down -v
    • go to your laradock/phpmyadmin directory, you should see this directory: just laradock directory
    • look in that directory using your mac file browser, there should be a phpmyadmin.config.inc.php file in there
    • move that file one directory up. In Linux it's this command: mv phpmyadmin.config.inc.php ..
    • go one directory up, you're now in the ~/laradock/phpmyadmin directory
    • you'll have a directory of config.user.inc.php and a file of phpmyadmin.config.inc.php, see screenshotdirectory contents
    • the goal is:
    • to "remove" the directory config.user.inc.php
    • to rename phpmyadmin.config.inc.php to config.user.inc.php
    • to adjust docker-compose.yml

    [] rm -Rf config.user.inc.php remove directory [] mv phpmyadmin.config.inc.php config.user.inc.php rename file Your directory structure should look like this: enter image description here [] adjust docker-compose.yml:

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

    bring your containers up again:

    docker-compose up nginx mysql php-fpm phpmyadmin workspace -d
    

    Explanation In your docker-compose.yml file you had a volume like this:

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

    If docker cannot find the file, it creates a directory with that filename, to make the volume. That is the reason why your changes didn't come through. If you bring the container down again (volume down as well), that created directory doesn't get deleted.

    The suggestion is to remove the /phpmyadmin.config.inc.php and place the config.user.inc.php file in the phpmyadmin directory (next to the Dockerfile) If you correct your docker-compose.yml file and then do the docker-compose up it will add your volume with the correct file.

    In the end I added this to the config file: $cfg['Servers'][$i]['hide_db'] = 'default|information_schema|mysql|performance_schema|sys'; and the system tables are missing from my phpmyadmin screen: no system tables