0
votes

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

Filename: C:/wamp/www/myproject/system/database/DB_driver.php

Line Number: 436

My SQL Server is placed in a different machine. And my WampServer is running from a different machine in Windows 7. if the project is in the same machine with the SQL server the project is working. But what I want is to separate the wampserver.

[Fri Jul 26 15:08:14.153955 2019] [core:notice] [pid 2868:tid 376] AH00094: Command line: 'c:\wamp\bin\apache\apache2.4.9\bin\httpd.exe -d C:/wamp/bin/apache/apache2.4.9'

[Fri Jul 26 15:08:14.153955 2019] [mpm_winnt:notice] [pid 2868:tid 376] AH00418: Parent: Created child process 3556 [Fri Jul 26 15:08:14.699956 2019] [mpm_winnt:notice] [pid 3556:tid 304] AH00354: Child: Starting 64 worker threads.

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'MYHOST',
    'username' => 'root',
    //'port' => '1433',
    'password'=> 'MYPWD',
    'database' => 'MYDB',
    'dbdriver' => 'sqlsrv',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => TRUE,
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);
4
Is that the only error you are getting? Have you checked all the logs - RiggsFolly
It's a little unclear what your actual question is. The line number won't help anything unless we know what code you're working with.. The snippet you posted looks like standard connection configuration. Have you tried changing MYHOST to the actual database hostname? - Moritz Friedrich
Have you changed the firewall on the SQLServer machine to allow access through port 1433 (or whichever port SQLServer is using - RiggsFolly
hostname' => 'MYHOST', Should probably look like hostname' => '11.22.33.44', an Ip Address. Does it? - RiggsFolly
i have tried change "MYHOST" to the actual ip address - Lesley Mabaylan

4 Answers

0
votes

You are required to open the firewall on the intranet MS SQL SERVER. That server needs a public IP-address. And make sure to only allow your host servers IP-address. After that just specify the public IP-adress and Username/Password in your Codeigniter configuration everything should be good to go.

https://forum.codeigniter.com/thread-69458.html

0
votes

Enable the port setting 1433.

Can u place a php program in that SQL server machine and able to connect with that? If it gets connected then the problem is with the connection parameters.

Try to connect that SQL server from a different machine by a sample codeigniter connecting program.If it gets connected then the problem is in ur machine parameters.

0
votes

Could u verify these steps especially the TCP ip setting of sql server and ip address,port settings of code igniter as follows::Similarly r u able to ping the sql server machine from ur PHP machine.

https://futbolsalas15.wordpress.com/2014/02/23/7-steps-to-make-sql-server-and-codeigniter-works/

0
votes

What about connecting a Mysql database that is placed in the same SQL server machine from the remote Xammp server.