-
Sub-task
-
Resolution: Fixed
-
Blocker
-
2.0
-
None
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
The following bit of code, where it tries to use a socket connection if you are on localhost, does not work here on my computer.
Worse, it fails with the generic
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been
correctly specified in config.php
error, which gives you no clue as to what is actually happening. It took me quite a lot of digging around to acutally get the error message, and find it was coming from around this bit of code, and then try adding 'false and ' to the start of this if statement to make it work again. (Luckily, I knew that you had worked on this over the weekend, so I knew roughly where to look.)
Using sockets seems like a good idea in principle, but it needs to be reliable. Sorry to be the bearer of ill news Petr.
// Unix socket connections should have lower overhead
if (empty($this->dboptions['forcetcp']) and ($this->dbhost === 'localhost' or $this->dbhost === '127.0.0.1'))
else {
if (empty($this->dboptions['dbport']))
else
{ $port = $this->dboptions['dbport']; } $connection = "host='$this->dbhost' port='$port' user='$this->dbuser' password='$pass' dbname='$this->dbname'";
}