PHP error connecting to MS SQL 2005 using CodeIgniter

587 views Asked by At

I'm encountering an error every time I'm connecting to my MS SQL 2005 database using CodeIgniter framework, I'm using PHP 5.6.8 version.`

"Fatal error: Call to undefined function sqlsrv_connect() in C:\xampp\htdocs\my_website\system\database\drivers\sqlsrv\sqlsrv_driver.php on line 76"

I've already added dll files php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll to ext folder and on my php.ini, and installed Microsoft SQL Native Client 2012, this is my code in the sqlsrv_driver.php line 76 -> return sqlsrv_connect($this->hostname, $connection);

I already setup and installed all needed files but still I encounter this error, and NO sqlsrv in phpinfo(), so I created a sample php file to test if I will connect to my database w/out using a framework and its successfully connected in MS SQL database, However it doesn't if I used codeigniter.

Did I miss some code, configuration or software to install? Thanks for usual support!

This is my database.php

$db['default']['hostname'] = 'MY-PC\MSSQL2005';
$db['default']['username'] = 'sa';
$db['default']['password'] = 'password';
$db['default']['database'] = 'MYDB';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
0

There are 0 answers