estoy intentando conectarme desde PHP a un servidor de SQLServer 2008 R2.
No me estoy pudiendo conectar, me tira el error de TrustServerCertificate=false:
Tengo el siguiente código pero no se donde exactamente debo agregar el TrustServerCertificate=false.
he probado con una conexion estandar y me funciona bien usando sqlsrv_connect.
pero en este no logro dar con la talla
private function __construct($dbtype, $db_host, $db_name, $db_user, $db_pass) {
$this->host = $db_host;
$this->name = $db_name;
$this->user = $db_user;
$this->pass = $db_pass;
$this->type = $dbtype;
$db_driver = strtolower($this->name) == "lin2db" || strtolower($this->name) == "lin2world" ? "sqlsrv:Server" : "mysql:host";
$db_database = strtolower($this->name) == "lin2db" || strtolower($this->name) == "lin2world" ? "Database" : "dbname";
if($this->type == "login"){
try {
self::$db_login = new \PDO($db_driver."=".$this->host."; ".$db_database."=".$this->name, $this->user, $this->pass);
self::$db_login->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
self::$db_login->exec('SET NAMES utf8');
} catch (PDOException $e) {
return false;
}
}elseif($this->type == "game"){
try {
self::$db_game = new \PDO($db_driver."=".$this->host."; ".$db_database."=".$this->name, $this->user, $this->pass);
self::$db_game->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
self::$db_game->exec('SET NAMES utf8');
} catch (PDOException $e) {
return false;
}
}else{
return false;
}
}