微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Codeigniter:如何设置与SQL服务器的连接(2008)

我花了很多天才完成这项任务,直到现在我才看到结局.在过去的一天,我成功地在我的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 – 在那里查看我的答案,因为它解决了该特定开发人员的问题.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐