phpmyadmin / docker

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

Adding server in /etc/phpmyadmin/config.user.inc.php not working #342

Closed paranerd closed 3 years ago

paranerd commented 3 years ago

Hi all,

I'm having trouble setting up multiple database servers in config.user.inc.php

Here's the content of my config.user.inc.php:

$i++;
$cfg['Servers'][$i]['verbose'] = 'My Database Server';
$cfg['Servers'][$i]['host'] = '192.168.1.45';
$cfg['Servers'][$i]['port'] = '9002';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

This is my run command:

sudo docker run -d -v /home/username/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php -p 8080:80 --name phpmyadmin phpmyadmin

I did no other modifications, just create the file and run the command.

I was expecting a dropdown menu on the index.php but it just asks me for username and password.

Am I missing something?

williamdes commented 3 years ago

Hi @paranerd

I bet you are missing a <?php line before your config block :) ?

paranerd commented 3 years ago

I can't believe I missed that... Thanks for the quick support :-D!

paranerd commented 3 years ago

Sorry for resurrecting this, but I just realized that this only works if I add at least 2 servers in config.user.inc.php.

So:

<?php

$i++;
$cfg['Servers'][$i]['verbose'] = 'My Database Server';
$cfg['Servers'][$i]['host'] = '192.168.1.45';
$cfg['Servers'][$i]['port'] = '9002';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

$i++;
$cfg['Servers'][$i]['verbose'] = 'My Database Server 2';
$cfg['Servers'][$i]['host'] = '192.168.1.45';
$cfg['Servers'][$i]['port'] = '9002';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

works but

<?php

$i++;
$cfg['Servers'][$i]['verbose'] = 'My Database Server';
$cfg['Servers'][$i]['host'] = '192.168.1.45';
$cfg['Servers'][$i]['port'] = '9002';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

doesn't.

Any idea why that might be?

williamdes commented 3 years ago

Hi @paranerd

This does not make sense, but yeah there is no more selector if the server list has only one item

I feel like I miss something to understand what is actually wrong

By the way you can remove the extension mysqli configs as they are not used in actual versions

paranerd commented 3 years ago

Never mind me... I was expecting the selector in any case but that wouldn't actually make sense as you point out. Everything is working as expected.

Thank you and sorry for wasting your time 😄

williamdes commented 3 years ago

Never mind me... I was expecting the selector in any case but that wouldn't actually make sense as you point out. Everything is working as expected.

Thank you and sorry for wasting your time

No worries 😄 Have a nice week !