• I am having an issue connecting with the External Login plugin. Here is the error in php_errors.log. The database name, host, and port are correct.

    [25-May-2022 17:06:24 UTC] EXLOG:
    [25-May-2022 17:06:24 UTC] 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 => '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 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.',
      ),
    )

    I am able to connect with a test from php using the following (my real values replaced with XXXVALUE):

    
    

    $serverName = “XXXSERVENAME, XXXPORT”;
    $connectionInfo = array( “Database”=>”XXXDATABASE”, “UID”=>”XXXUSERNAME”, “PWD”=>”XXXPASSWORD”);
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if( $conn ) {
    echo “Connection established.<br />”;
    }else{
    echo “Connection could not be established.<br />”;
    die( print_r( sqlsrv_errors(), true));
    }`
    `

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ccsimmons

    (@ccsimmons)

    Hi,

    I think I have figured this out…

    In the file db.php the following line does not take into account setting a port (external_login_option_db_port) for MSSQL:

    $db_instance = sqlsrv_connect( exlog_get_option("external_login_option_db_host"), $connectionOptions);

    Would it be possible to get this updated? We run MSSQL on a nonstandard port. Without the port the connection fails.

    Thanks.

    Plugin Author tbenyon

    (@tbenyon)

    Hey @ccsimmons,

    If you could create a pull request I’ll review it and see if I can get this updated for you ??

    https://github.com/tbenyon/wordpress_external_login_plugin

    Thanks,

    Tom

    Thread Starter ccsimmons

    (@ccsimmons)

    I’d be happy to do a pull request. That github link was a 404 for me though. Found your username in a search but didn’t see the repo.

    Plugin Author tbenyon

    (@tbenyon)

    Hey @ccsimmons,

    Didn’t realise I’d made it private.

    Have another look and let me know if you have access ??

    Tom

    Thread Starter ccsimmons

    (@ccsimmons)

    Got it. Thanks! I tried to code it the way you did the port check in the MySQL except checking , instead of :

    Hopefully I did the pull request correctly.

    Thanks

    Plugin Author tbenyon

    (@tbenyon)

    Just had an initial read. ??

    For convention I would have preferred it used the same syntax with the colon. In my experience the : is a more standard separator for host and port.

    Was there a reason you went with a comma?

    Tom

    Thread Starter ccsimmons

    (@ccsimmons)

    I believe SQL server requires a comma. I just tried it with a colon and it won’t connect:

    [message] => [Microsoft][ODBC Driver 17 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87].

    See Example #3:
    https://www.php.net/manual/en/function.sqlsrv-connect.php

    It’s the same convention (comma) when you specify a port to connect using Sql Server Management Studio.

    • This reply was modified 2 years, 6 months ago by ccsimmons.
    • This reply was modified 2 years, 6 months ago by ccsimmons.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error 500 connecting to MSSQL’ is closed to new replies.