连接CodeIgniter 3与SQL服务器 [英] Connect CodeIgniter 3 with SQL server

查看:211
本文介绍了连接CodeIgniter 3与SQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的项目使用CodeIgniter 3.0.6。
我需要连接我的webapp与MS的sql服务器。这是我的情况:

I'm currently using CodeIgniter 3.0.6 for my project. I need to connect my webapp with a MS sql server. That's my situation:

PHP版本:5.6对locahost和5.4对我们内部网。

PHP version: 5.6 on locahost and 5.4 on us intranet.

Windows Server 2008 R2

Sql version: MS Windows Server 2008 R2

我已经在两台服务器上安装了所有DLL ext

I've already installed on both server all DLL ext

PHP 5.6

extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll

PHP 5.4

extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dl



在我的CI配置数据库中,我有:

On my CI configuration DB I have:

'dsn'       => '',
'hostname'  => 'MYHOST',
'username'  => 'USER',
'password'  => 'PSW',
'database'  => 'DB',
'dbdriver' => 'sqlsrv',

但我也尝试过

'dsn' => 'sqlsrv:server=HOST,1433;Database=DBNAME',
'dbdriver' => 'sqlsrv',
'subdriver' => 'pdo'

总是出现同样的错误:

Unable to connect to your database server using the provided settings.
Filename: C:/xampp/htdocs/system/database/DB_driver.php
Line Number: 436

我在stackoverflow上阅读了很多教程和问题,但所有doens't工作。

I've read a lot of tutorial and question here on stackoverflow but all doens't work.

帮助我找到解决方案,我很疯狂!

Help me please to find a solution, I'm gettin crazy!

推荐答案

我们有一个项目与MSSQL服务器(Navision作为ERP的背后)和CI。
我们与微软的官方(病人!)驱动程序有很大的麻烦,也有与64位环境的问题;

We've a project with MSSQL Server (Navision as an ERP behind of that) and CI. We had huge troubles with the official (sick!) driver from Microsoft and had problems with the 64 bit environment too;

经过长时间的研究,我们发现非官方发布 - 阅读以下链接的帖子。它对我们来说很像一个魅力:

After long research we found an unofficial release - read the posts of the following links. It worked like a charm for us:

如何为PHP安装Microsoft的SQL Server驱动程序

PHP非正式Microsoft SQL Server驱动程序(sqlsrv)

这篇关于连接CodeIgniter 3与SQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆