繁体   English   中英

无法从Codeigniter 2.1.4连接到SQL Server 2012

[英]Cannot connect to SQL Server 2012 from codeigniter 2.1.4

警告

发生数据库错误

无法使用提供的设置连接到数据库服务器。

文件名:D:\\ xampp \\ htdocs \\ 214report \\ system \\ database \\ DB_driver.php

行号:124

源代码

mmanagement / config / database.php

$ active_group ='默认';

$ active_record = TRUE;

$ db ['default'] ['hostname'] ='HOSTNAME';

$ db ['default'] ['username'] ='user';

$ db ['default'] ['password'] ='password';

$ db ['default'] ['database'] ='报告';

$ db ['default'] ['dbdriver'] ='sqlsrv';

$ db ['default'] ['dbprefix'] ='';

$ db ['default'] ['pconnect'] = TRUE;

$ db ['default'] ['db_debug'] = TRUE;

$ db ['default'] ['cache_on'] = FALSE;

$ db ['default'] ['cachedir'] ='';

$ db ['default'] ['char_set'] ='utf8';

$ db ['default'] ['dbcollat​​'] ='utf8_general_ci';

$ db ['default'] ['swap_pre'] ='';

$ db ['default'] ['autoinit'] = TRUE;

$ db ['default'] ['stricton'] = FALSE;

php.ini

扩展名= php_pdo_sqlsrv_54_ts.dll

扩展名= php_sqlsrv_54_ts.dll

有问题吗?

如何解决这个问题?

如果需要,请向我询问更多源代码。

1)尝试查看是否满足所有系统要求

2)通过查看phpinfo()来尝试查看Sqlserv是否已加载;

根据MS网站http://www.microsoft.com/en-in/download/details.aspx?id=20098

sqlserv的系统要求/支持的操作系统

Windows 7,Windows 8,Windows 8.1,Windows Server 2008 R2,Windows Server 2008 Service Pack 2,Windows Vista Service Pack 2

The following summarizes requirements. It will be important to see System Requirements (Microsoft Drivers for PHP for SQL Server) for more detail.

    Requires PHP 5.x. For information about how to download and install the latest stable binaries, visit http://windows.php.net for more detail.
    Version support for PHP is as follows
        Version 3.2 supports PHP 5.6, 5.5, and 5.4
        Version 3.1 supports PHP 5.5 and 5.4
        Version 3.0 supports PHP 5.4.

    For more detail and for supported operating systems, see System Requirements (Microsoft Drivers for PHP for SQL Server) .

    An Internet Information Services (IIS) Web server is required
    Versions 3.2 and 3.1 of the driver require Microsoft ODBC Driver 11 (or higher). You can download the Microsoft ODBC Driver 11 for SQL Server from the Microsoft® ODBC Driver 11 for SQL Server® - Windows page.
    Version 3.0 requires the x86 version of Microsoft SQL Server 2012 Native Client.
    Version 2.0 requires the x86 version of Microsoft SQL Server 2008 R2 Native Client.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM