简体   繁体   中英

Cannot connect to SQL Server 2012 from codeigniter 2.1.4

Warning

Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: D:\\xampp\\htdocs\\214report\\system\\database\\DB_driver.php

Line Number: 124

Source code

mmanagement/config/database.php

$active_group = 'default';

$active_record = TRUE;

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

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

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

$db['default']['database'] = 'Report';

$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

extension=php_pdo_sqlsrv_54_ts.dll

extension=php_sqlsrv_54_ts.dll

Questions ?

How do solve this problem ?

please ask to me for more source code if you need.

1) Try seeing if all the system are requirements are met

2) Try to see if the Sqlserv is loaded by looking at the phpinfo();

As per the MS Site http://www.microsoft.com/en-in/download/details.aspx?id=20098

System Requirements /Supported Operating System for 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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