jeudi 11 juin 2015

PHP error connecting to MS SQL 2005 using Code Igniter

Good day!

I'm encounter an error every time I'm connecting to my MS SQL 2005 server using Code Igniter 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 already add dll files php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll to ext folder and on my php.ini, and install 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 install all needed files but still I encounter this error, So I create a sample php file to test if I will connect to datatbase w/out using a framework and its successfully connected in MS SQL server. but not I if used code igniter.

Did I missed 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;

Aucun commentaire:

Enregistrer un commentaire