Jump to content

Archived

This topic is now archived and is closed to further replies.

stockton

mssql_connect failing on localhost(Windows XP)

Recommended Posts

I have a connection script

<?php
function DBConnect() {
    global $dbservertype, $servername, $dbusername, $dbpassword, $dbname, $link;
    $link = mssql_connect($servername, $dbusername, $dbpassword) or die("Unable to connect to T4T database at $servername, UID=$dbusername, UPASS=$dbpassword");
    if (!(mssql_select_db($dbname, $link))) {
        echo "Error in DBConnect() = " . mssql_get_last_message();
        sprintf($Message, "At %d in %s Could not select %s at %s as %s",__LINE__, __FILE__, $dbname, $servername, $dbusername);
        trigger_error(E_USER_ERROR, $Message);
        exit;
        }
    return $link;
    }
?>

 

that fails connecting with the following message

 

Unable to connect to T4T database at localhost, UID=sa, UPASS=sa

 

Please suggest where I may look to resolve this issue.

Share this post


Link to post
Share on other sites

try not using localhost, use database server address

eg. 60.52.132.85:1413 or 60.52.132.85

Share this post


Link to post
Share on other sites

I have tried localhost & 127.0.0.1 & 192.168.1.10 and all of them give the same answer, failing to connect.

Share this post


Link to post
Share on other sites

check the php.ini file

remove the ';'

example:

;extension=php_mssql.dll

to

extension=php_mssql.dll

 

run phpinfo() to check whether php_mssql is active.

Share this post


Link to post
Share on other sites

That was done some time back and php_mssql is active as it can be accessed from other machines on my intranet. Just not from the same machine.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.