Sql-server – Cannot connect PHP to SQL Server in no way

PHPsql server

I installed SQL Server and it shows enabled in phpinfo(). But when setting up joomla on database config page when I choose SQL Server and try to connect the following error comes up

Could not connect to the database. Connector returned number: Database sqlsrv_connect failed, Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 67 [code] => 67 [2] => [Microsoft][ODBC Driver 13 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [67]. [message] => [Microsoft][ODBC Driver 13 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [67]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired [message] => [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 67 [code] => 67 [2] => [Microsoft][ODBC Driver 13 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 13 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. ) )

Best Answer

This is NOT 18456 (login failed). The error says

Server is not found or not accessible

And it means that you should control that:

  • SQL Server is started and running
  • you use the correct instance name (so show us your connection string), and if the instance is named, SQL Server Browser also should be running
  • TCP\IP is enabled

You cannot find anything in error log because the server was not reached at all.