I have issue when using phpIPAM with our database which require SSL connection as it sits on another machine.
It would be nice to have this feature add in the next release.
I have created a crude work around which hopefully help kick start the process.
Modify functions/checkPhpBuild.php
if($_GET['page']!="install") {
// Non-SSL connection
// $mysqli = @new mysqli($db['host'], $db['user'], $db['pass'], $db['name']);
// End of Non-SSL connection
// SSL Connection
$mysqli = mysqli_init();
$mysqli->real_connect($db['host'], $db['user'], $db['pass'], $db['name'], 3306, NULL, MYSQLI_CLIENT_SSL);
// End of SSL Connection
// check connection
if ($mysqli->connect_errno) {
// die with error
die('<div class="alert alert-danger"><strong>'._('Database connection failed').'!</strong><br><hr>Error: '. mysqli_connect_error() .'</div>');
}
}
Modify functions/dbfunctions.php
public function __construct($host = NULL, $username = NULL, $dbname = NULL, $port = NULL, $socket = NULL, $printError = true) {
# throw exceptions
mysqli_report(MYSQLI_REPORT_STRICT);
# open database connection
// SSL Connection
parent::__construct();
try { $this->real_connect($host, $username, $dbname, $port, $socket, NULL, MYSQLI_CLIENT_SSL); }
// End of SSL Connection
// Non-SSL connection
// try { parent::__construct($host, $username, $dbname, $port, $socket); }
// End of Non-SSL connection
catch (Exception $e) {
if($printError) { print "
error:".$e->getMessage().""; }
return false;
}
if(!isset($e))
$this->set_charset("utf8");
# change back reporting for exception throwing to scripts
//mysqli_report(MYSQLI_REPORT_ERROR);
}
Anonymous
Hi ! Can you check 1.2 beta (https://github.com/phpipam/phpipam) and test / find solution ? I moved to pdo from mysqli.
Implemented in 1.2