0
我想連接到SQL Server 我的php版本是5.4,我有MS SQL Server 2008 R2和我使用PHP Codeigniger 2.4連接到SQL Server
我改變database.php中配置
$db['default']['hostname'] = '192.168.5.208';
$db['default']['username'] = 'xxx';
$db['default']['password'] = 'xxx';
$db['default']['database'] = 'xxx';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$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;
我下載了sqlsrv30.exe。 安裝在PHP /分機
我想補充的php.ini文件如下:
extension=php_sqlsrv_54_ts.dll
我安裝Native Client的10
我改變sqlsrv_driver.php文件夾中的數據庫驅動程序SQLSRV到
function db_pconnect() {
//return $this->db_connect(TRUE);
return $this->db_connect(TRUE);
}
我也嘗試添加
db['default']['port'] = 1433;
但它仍然無法正常工作。我總是遇到ff。錯誤:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\HRM\system\database\DB_driver.php
Line Number: 124
我該怎麼辦?請幫助
不不,這不是解決問題 –
看我改變了我的回答對您的意見 – user2092317
感謝,最後我解決這個問題,它只是因爲sqlsrv需要本機客戶端11,但我的是10,謝謝 –