0

This is my database.php (I am using XAMPP and CODEIGNITER). I cannot connect to a SQLSERVER database (it is a mess)

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'SER054USA',//server_name
    'username' => 'admin',
    'password' => '45645sfd45',
    'database' => 'PROD',
    '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 got this error massage:

No connection could be made because the target machine actively refused it

I have tried so many times but i was not able to solve this.

I have searched a lot, seen several threads but no one really helped me.

JustToKnow
  • 785
  • 6
  • 23

1 Answers1

0

Your database driver is wrong. mysqli is for mysql

Tou need to set your driver to sqlsrv

To install that, please go to https://www.microsoft.com/en-us/download/details.aspx?id=20098 and get the driver for your appropiate php version. Once you installed it for your version of XAMPP, enable it, and set sqlsrv in your database config file

Restart apache and you should be good to go.

Raul
  • 579
  • 1
  • 4
  • 13
  • Thank you for replying, Raul! Could you please help me to install that driver? What should i do first?.I am pretty lost :/ – JustToKnow Oct 15 '19 at 02:56
  • Dude, i was not able to enable it :(. Could you please explain to me how to do that in XAMPP? – JustToKnow Oct 16 '19 at 22:46
  • I'm sorry, i do not have windows - please search on SO on how to do that. Here's [an article](https://support.scriptcase.net/en-us/article/1304-installation-of-sql-server-drivers-in-a-xampp-in-production-environment) i found, hope it helps – Raul Oct 16 '19 at 22:49