Skip to main content


PHP error log thrown in /src/Database/Database.php on line 191


@Friendica Support

#bugResearch

hi there, I have this message in my php.error.log

what should I do?

I didn't have a look at gitHub

php.error.log Database.php on line 191thrown in /var/www/html/src/Database/Database.php on line 191
[14-Nov-2023 14:15:30 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/www/html/src/Database/Database.php:191
Stack trace:
#0 /var/www/html/src/Database/Database.php(191): mysqli->__construct()
#1 /var/www/html/src/Database/Database.php(97): Friendica\Database\Database->connect()
#2 [internal function]: Friendica\Database\Database->__construct()
#3 /var/www/html/vendor/level-2/dice/Dice.php(132): ReflectionMethod->invokeArgs()
#4 /var/www/html/vendor/level-2/dice/Dice.php(96): Dice\Dice->Dice\{closure}()
#5 /var/www/html/src/DI.php(98): Dice\Dice->create()
#6 /var/www/html/src/DI.php(66): Friendica\DI::dba()
#7 /var/www/html/src/DI.php(54): Friendica\DI::setCompositeRootDependencyByHand()
#8 /var/www/html/index.php(35): Friendica\DI::init()
#9 {main}
thrown in /var/www/html/src/Database/Database.php on line 191

Platform Info: 2023.05 - stableFriendica Version: 2023.05 - stable
Friendica Source: gitHub
PHP version: 8.1.2-1ubuntu2.14
SQL version: MySQL / MariaDB
memory_limit 256M
4 Core CPU, 8 GB Ram with 300GB NVME Disk
#1 #2 #4 #bugResearch #3 #5 #6 #7 #8 #9
@utopiArte that starts with a "connection refused"
is the mysql server connecting at all? Is the password right?
@utopiArte Connection refused means that your database configuration is wrong in your local.config.php file.
This entry was edited (8 months ago)
this error message appears like every once in a while.
there is this doubt I have that I posted before:
https://tupambae.org/display/0ac89072-3265-57ac-9e2e-ad6124730963

@silverwizard
> is the mysql server connecting at all?

Could I be able to domost things but not with all profiles?
I mean I posted these helpreuqestsuploadpictures, answer posts, get notifications.
There a profiles that can't comment on public posts of others even tho they should be able to.

@Friendica Support

Is there a way to do some kind of general recheck of the settings inside the DB or something like that?

This server was hosted at a BETA testing.
In the local.config.php there was apparently a wrong setting:
'hostname' => 'subdomain.oldhosting.com:3306',<-- WRONG SETTING AT OLD PROVIDER!!!
'hostname' => 'localhost',<-- Correct setting!

Different things on that installation didn't work, like posting to the helpers forum, a 500 error showed up.

There are several bugs I encounter that don't look to me like "normal" in the sense that they should have been noticed and fixed by the community in any case already.

So now I wonder if there is some routine I can execute that checks settings that could have been set wrongly, be it by the error described above or other problems.

@utopiArte If it’s sporadic and your node mostly works, then your database server might be acting up. In this case, there’s little that can be done at the Friendica level. Has your database server enough resources to run?
@Hypolite Petovan @utopiArte Typically I'd expect it to be a network error rather than an overload with that specific error, but easy to be both
@silverwizard Wouldn’t a network issue result in a timeout rather that a refused connection?
Have a look at the spoiler above:
Platform Info: 2023.05 - stable
memory_limit 256M
4 Core CPU, 8 GB Ram with 300GB NVME Disk

That should be more than suffice and the server has basically no users, only some forum pages with few followers as of now.

Again, going back to my initial question of the other help request.
https://tupambae.org/display/0ac89072-3265-57ac-9e2e-ad6124730963

Is it possible that in the moment of initial installation on the BETA testing site the setting:
'hostname' => 'subdomain.oldhosting.com:3306'
was registered somewhere in the DB and is messing now with some functionality while the node actually migrated to a standard Ubuntu VPS that doesn't use some kind of SNAP installation?

@Friendica Support

Is there a way to do some kind of general recheck of the settings inside the DB or something like that?

This server was hosted at a BETA testing.
In the local.config.php there was apparently a wrong setting:
'hostname' => 'subdomain.oldhosting.com:3306',<-- WRONG SETTING AT OLD PROVIDER!!!
'hostname' => 'localhost',<-- Correct setting!

Different things on that installation didn't work, like posting to the helpers forum, a 500 error showed up.

There are several bugs I encounter that don't look to me like "normal" in the sense that they should have been noticed and fixed by the community in any case already.

So now I wonder if there is some routine I can execute that checks settings that could have been set wrongly, be it by the error described above or other problems.

@utopiArte @Hypolite Petovan yeah - if the user is allowed access from only subdomain.oldhosting.com in mysql (check the users table) then you wont have access and your connection will be refused