-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
2.7.8
-
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.
- has been marked as being related by
-
MDL-54704 SSL-support for connection to Postgres and MySQL Database
- Closed