$conn = mysqli_init();
$conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$conn->ssl_set(NULL, NULL, '~/.mysql/root.crt', NULL, NULL);
$conn->real_connect('rc1a-cz4mil27ne5v5y6k.mdb.yandexcloud.net', '0000', '<0000>', '0000', 3306, NULL, MYSQLI_CLIENT_SSL);
$connection = \mysqli_init();
$connection->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$connection->ssl_set(NULL, NULL, '/var/www/www-root/data/.mysql/root.crt', NULL, NULL);
$this->db_Conn = mysqli_connect($persistentPrefix.$dbHost, $this->DBLogin, $this->DBPassword, $this->DBName, $dbPort);
$this->db_Conn = \mysqli_init();
$this->db_Conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$this->db_Conn->ssl_set(NULL, NULL, '/var/www/www-root/data/.mysql/root.crt', NULL, NULL);
$this->db_Conn->real_connect($persistentPrefix.$dbHost, $this->DBLogin, $this->DBPassword, $this->DBName, $dbPort);
protected function connectInternal()
{
if ($this->isConnected)
return;
$host = $this->host;
$port = 0;
if (($pos = strpos($host, ":")) !== false)
{
$port = intval(substr($host, $pos + 1));
$host = substr($host, 0, $pos);
}
if (($this->options & self::PERSISTENT) != 0)
$host = "p:".$host;
/** @var $connection \mysqli */
$connection = \mysqli_init();
if (!$connection)
throw new ConnectionException('Mysql init failed');
if (!empty($this->initCommand))
{
if (!$connection->options(MYSQLI_INIT_COMMAND, $this->initCommand))
throw new ConnectionException('Setting mysql init command failed');
}
if ($port > 0)
$r = $connection->real_connect($host, $this->login, $this->password, $this->database, $port);
else
$r = $connection->real_connect($host, $this->login, $this->password, $this->database);
if (!$r)
{
throw new ConnectionException(
'Mysql connect error ['.$this->host.']',
sprintf('(%s) %s', $connection->connect_errno, $connection->connect_error)
);
}
$this->resource = $connection;
$this->isConnected = true;
// nosql memcached driver
if (isset($this->configuration['memcache']))
{
$memcached = \Bitrix\Main\Application::getInstance()->getConnectionPool()->getConnection($this->configuration['memcache']);
mysqlnd_memcache_set($this->resource, $memcached->getResource());
}
$this->afterConnected();
}