Hello all,
I have been really enjoying using Piwigo, I have it set up on a 500GB drive on my home server using Open Media Vault and Docker, its available to the LAN only. I put lots of work into it today, adding and tagging images and then thought I should back it up.
I set an rsync job up to do this and tested it, the idea was to copy everything to another disk in the server.
Everything copied over fine and so I rebooted ther server after also backing up the system disk.
Now I am getting this error and I'm not sure why its happened, or how I should fix it. Any help here would be much appreciated as I have made mistakes before and installed Piwigo about 3 times! I really would like to avoid haveing to start all over again and also, I might learn something!.
I have ssh'd into the server and I can see all of the directories there - nothing seems out of place at a glance, so I don't think I have dome anything disastrous like got my source and destination drives mixed up in the rsync command (also I omitted the --delete switch, so that should have kept things super safe!)
Here's the error message at the web GIU:
Warning: mysqli::__construct(): (HY000/2002): Connection refused in /config/www/gallery/include/dblayer/functions_mysqli.inc.php on line 52
Warning: my_error(): Couldn't fetch mysqli in /config/www/gallery/include/dblayer/functions_mysqli.inc.php on line 856
Warning: my_error(): Couldn't fetch mysqli in /config/www/gallery/include/dblayer/functions_mysqli.inc.php on line 856
Piwigo encountered a non recoverable error
[mysql error ]
Can't connect to server
#1 my_error /config/www/gallery/include/common.inc.php(113)
#2 include_once /config/www/gallery/index.php(11)
Thank you, guys!
Nick.
Piwigo 11.1.0
Operating system: Linux
PHP: 7.3.26 (Show info) [2021-01-26 16:52:34]
MySQL: 5.5.5-10.4.17-MariaDB-1:10.4.17+maria~bionic-log [2021-01-26 16:52:34]
Graphics Library: ImageMagick 7.0.10-48
Offline
it can't connect to the database
make sure host/user/password are correct in config file
Offline
Thanks, is this in: /config/www/gallery/include/dblayer/functions_mysqli.inc.php and do you have any idea why it might have changed?
Cheers,
Nick.
Offline
Looks like your Piwigo Docker container can't talk to the database one.
Maybe there's some inspiration in these
https://www.networkshinobi.com/piwigo-o … ediavault/
https://forum.openmediavault.org/index. … k-install/
Offline
At the very least check your
/config/www/gallery/local/config/database.inc.php
file if it contains the correct database name, host and user/password credentials.
Offline
Yay, this is the one that solved things.
It turned out that the IP address in database.inc.php was incorrect, it was lsited as 172.17.0.4, but when I checked the container, it should have been 172.17.0.3
You have saved me a lot of work and frustration - thanks very much! Still scratching my head as to why this might have happened though, but at least i have this for future reference.
Many thanks again erAck :)
Nick.
erAck wrote:
At the very least check your
/config/www/gallery/local/config/database.inc.php
file if it contains the correct database name, host and user/password credentials.
Last edited by nickO (2021-01-26 22:12:33)
Offline
It sounds like you’re using a bridge network in docker. That IP can keep changing on you, but you can use the name of the db’s docker container to always resolve to its current IP address.
Offline
Hi there,
Thanks - this is very interesting as this error message appeared before but I couldn't work out why. The error message was very similar so this is defo something to check in the future. Thanks very much for pointing this out.
Nick.
Offline
OK, so back to this again.
I got another MySQL error so I checked the IP address, which had again changes so I ssh'd into the server and edited the IP address as I did before. This gave me another MySQL error, so I changed the IP address to the db's docker container and that gave me a blank screen. Now, even if I enter the IP address, I just get a blank screen.
Any ideas, please?
Thank you,
Nick.
Last edited by nickO (2021-01-30 17:08:56)
Offline
ckayfish wrote:
It sounds like you’re using a bridge network in docker. That IP can keep changing on you, but you can use the name of the db’s docker container to always resolve to its current IP address.
OK, I just want to say that I have now changed it from the IP to the name of the db’s docker container and this seems to be working well.
For anybody else that would find this useful, navigate to:
/config/www/gallery/local/config
then
nano database.inc.php
<?php
$conf['dblayer'] = 'mysqli';
$conf['db_base'] = 'piwigo';
$conf['db_user'] = 'piwigo';
$conf['db_password'] = 'piwigo';
$conf['db_host'] = change the IP ADDRESS HERE to the name of name of the db’s docker container;
$prefixeTable = 'piwigo_';
define('PHPWG_INSTALLED', true);
define('PWG_CHARSET', 'utf-8');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
?>
Hopefully I will not lose the connection again now.
Thanks for the advice,
Nick.
Offline