我在这个任务上花了很多天,直到现在我都看不到结局。在过去的一天里,我成功地在我的 PHP 环境中安装了 sqlsrv 驱动程序,但是现在当我尝试连接时,我收到了这条消息:
无法使用提供的设置连接到您的数据库服务器。
我的设置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
- 代码点火器 2.1.4