问题描述
我在这个任务上花了很多天,直到现在我还看不到结局.在过去的一天里,我成功地在我的 PHP 环境中安装了 sqlsrv 驱动程序,但是现在当我尝试连接时,我收到了这条消息:
I've spent many days on this task, and I can't see the end until now. In the past day I managed to install sqlsrv driver on my PHP environment successfully but now when I try to connect I get this message:
无法使用提供的设置连接到您的数据库服务器.
我在 application/config/database.php
中的设置是这样定义的:
My settings in application/config/database.php
are so defined:
$db['dbname']['hostname'] = "ENJ01SQLEXPRESS";
$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 连接
I've had the same trouble you've had about a year ago. Have a look at the replies here, there are some great suggestions from people in there: CodeIgniter MSSQL connection
此外,几天前在这里发布了一个线程:CI 连接到SQL SERVER - 也请查看我的回答,因为它为该特定开发人员解决了问题.
Also, a thread was posted a few days ago here: CI connect to SQL SERVER - check out my answer over there as well, since it's solved the problem for that particular developer.
这篇关于Codeigniter:如何设置与 SQL 服务器的连接 (2008)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!