Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14679 META: DB layer 2.0
  3. MDL-17374

postgres native driver, socket connection not working for me

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.0
    • 2.0
    • Database SQL/XMLDB
    • 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'))

      { $connection = "user='$this->dbuser' password='$pass' dbname='$this->dbname'"; }

      else {
      if (empty($this->dboptions['dbport']))

      { $port = 5432; }

      else

      { $port = $this->dboptions['dbport']; }

      $connection = "host='$this->dbhost' port='$port' user='$this->dbuser' password='$pass' dbname='$this->dbname'";
      }

            skodak Petr Skoda
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.