我花了很多天才完成这项任务,直到现在我才看到结局.在过去的一天,我成功地在我的PHP环境中成功安装了sqlsrv驱动程序,但是现在当我尝试连接时,我得到了这样的消息:
Unable to connect to your database server using the provided settings.
我在application / config / database.php中的设置如此定义:
$db['dbname']['hostname'] = "ENJ01\SQLEXPRESS";
$db['dbname']['username'] = "user";
$db['dbname']['password'] = "password";
$db['dbname']['database'] = "dbname";
$db['dbname']['dbdriver'] = "sqlsrv";
$db['dbname']['dbprefix'] = "";
$db['dbname']['pconnect'] = TRUE;
$db['dbname']['db_debug'] = TRUE;
$db['dbname']['cache_on'] = FALSE;
$db['dbname']['cachedir'] = "";
$db['dbname']['char_set'] = "utf8";
$db['dbname']['dbcollat'] = "utf8_general_ci";
$db['dbname']['swap_pre'] = '';
$db['dbname']['autoinit'] = TRUE;
$db['dbname']['stricton'] = FALSE;
有问题?
在这里我的环境配置:
> wampserver 2.4 x86
> PHP 5.4.16
> sqlsrv驱动程序 – > php_sqlsrv_54_ts.dll
> Codeigniter 2.1.4
解决方法:
我一年前遇到过同样的麻烦.看看这里的回复,那里有一些很棒的建议:CodeIgniter MSSQL connection
此外,几天前在这里发布了一个帖子:CI connect to SQL SERVER – 在那里查看我的答案,因为它解决了该特定开发人员的问题.