Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter and MS SQL Database


I'm learning PHP and CodeIgniter framework was highly recommended. I've been search the web for example and tip on how to connect CodeIgniter and MS SQL 2014. Sadly, I had no luck. This is my development setup:
  • IIS 7
  • PHP 7.1.21
  • MS SQL 2014
my database.php

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'hostname' => '',
    'username' => 'web_user',
    'password' => 'password',
    'database' => 'blogOne',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE

I'm getting the following error:

Quote:A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
Filename: mysqli/mysqli_driver.php
Line Number: 201
File: C:\inetpub\wwwroot\CITA-PHP\index.php
Line: 315
Function: require_once

thank you in advance for your help!

You must use the sqldrv driver not the mysqli.
And if you use the express edition don't for get the \SQLEXPRESS in the hostname.
Also I see not the port 1433 in the config.



Theme © iAndrew 2016 - Forum software by © MyBB