0

Good day, I have a project developed in the Codeigniter framework (PHP) which has a connection to SQLSERVER. The project locally is working fine, but when I uploaded it to a Windows server it shows me an error, the steps you took on the server were the same as you did on the server (put the .dlls in the php ext directory and call them in the php.ini file). I attach the error that you are sending me in the connection and I also attach my connection.

SQLSERVER connection

$db['sqlserver'] = array(
    'dsn'   => '',
    'hostname' => '192.2.2.2',
    'username' => 'sa',
    'password' => 'password',
    'database' => 'name_database',
    'dbdriver' => 'sqlsrv',
    '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
);

Error

enter image description here

I hope you can support me.

Thank you very much.

Javier fr
  • 119
  • 8
  • Not without the true error. Also, your web application should **not** be using the `sa` account. It should have it's own `LOGIN` and `USER`s with the minimal amount of permissions needed to fulfil its role. – Thom A Aug 26 '20 at 14:59
  • Does this answer your question? [CodeIgniter: Unable to connect to your database server using the provided settings Error Message](https://stackoverflow.com/questions/7254049/codeigniter-unable-to-connect-to-your-database-server-using-the-provided-settin) – André Walker Aug 26 '20 at 15:03
  • The SQLSERVER is on a different server where I am mounting the project. Locally it is working fine. How can I give you these permissions that you tell me? – Javier fr Aug 26 '20 at 15:07
  • I am making the connection to SQL SERVER. – Javier fr Aug 26 '20 at 15:09
  • Make a simple connection and it sends me the following error – Javier fr Aug 26 '20 at 15:26
  • Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. [message] => [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired [message] => [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired ) [2] => Array ( [0] – Javier fr Aug 26 '20 at 15:28
  • => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error – Javier fr Aug 26 '20 at 15:29
  • has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) ) – Javier fr Aug 26 '20 at 15:29
  • @Javierfr Check if TCP/IP is enabled (a similar [answer](https://stackoverflow.com/questions/49533539/php-sqlsrv-connect-to-sql-server-a-network-related-or-instance-specific-error-h/49609670#49609670)). – Zhorov Aug 27 '20 at 05:46
  • It shouldn't be connecting to remote servers with the Named Pipes Provider. Check which TCP/IP port your SQL server is actually listening on (usually 1433 for the default MSSQLSERVER instance) and add that to your configuration to force TCP/IP connections, e.g.: `'hostname' => '192.2.2.2,1433',` – AlwaysLearning Aug 29 '20 at 14:20

0 Answers0