I successfully tested that my PHP can connect to my MS SQL SERVER.
<?php
$server = 'SRV-MEXAL';
// Connect to MSSQL
$link = mssql_connect($server, 'mexal_db_usr', 'password_changed');
if (!$link) {
die('Something went wrong while connecting to MSSQL');
} else {
echo "Works <br>";
$OK = mssql_select_db ("at6_rp");
echo $OK ? "ok" : "ko";
}
?>
Using this script I got both Works
and ok
, so connection and db selection are both working.
I tried to configure my db connection into Yii 1 main.php
"mexal_db" => array (
'class' => "CDbConnection",
'connectionString' => 'sqlsrv:Server=SRV-MEXAL; Database=at6_rp',
'enableParamLogging' => false,
'username' => 'mexal_db_usr',
'password' => 'password_changed',
'charset' => 'utf8',
),
But when trying to instantiate it, I got this exception
CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in /var/www/httpdocs/test1.phonix.it/yii/framework/db/CDbConnection.php:399
What am I doing wrong?