Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50780

MySQL SSL-based database connections require require updating the Moodle's core code

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.7.8
    • General
    • None
    • MOODLE_27_STABLE

      When you use SSL network encryption to MySQL servers with the mysqli database type, you have to take the following steps:

      1. Add the following to /etc/my.cnf:
      [client]
      ssl-ca = path to certificate

      2. Add the following to [moodle production folder]/lib/dml/mysqli_native_database.php:
      Just after
      $this->mysqli = @new mysqli($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbsocket);

      in the function
      public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null)

      (~ line 444)

      Add this code:

      $this->mysqli = mysqli_init();
      $errorno = $this->mysqli->options(MYSQLI_READ_DEFAULT_FILE,'/etc/mysql/my.cnf');
      $errorno = $this->mysqli->options(MYSQLI_READ_DEFAULT_GROUP,'client');
      $this->mysqli->real_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbsocket, MYSQLI_CLIENT_SSL);

      There should be a way to implement this using config.php instead of having to hack lib/dml/mysqli_native_database.php.

            poltawski Dan Poltawski
            rloconne Rebecca O'Connell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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