stockton Posted May 28, 2009 Share Posted May 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/160009-mssql_connect-failing-on-localhostwindows-xp/ Share on other sites More sharing options...
cltn77 Posted June 2, 2009 Share Posted June 2, 2009 try not using localhost, use database server address eg. 60.52.132.85:1413 or 60.52.132.85 Quote Link to comment https://forums.phpfreaks.com/topic/160009-mssql_connect-failing-on-localhostwindows-xp/#findComment-847612 Share on other sites More sharing options...
stockton Posted June 2, 2009 Author Share Posted June 2, 2009 I have tried localhost & 127.0.0.1 & 192.168.1.10 and all of them give the same answer, failing to connect. Quote Link to comment https://forums.phpfreaks.com/topic/160009-mssql_connect-failing-on-localhostwindows-xp/#findComment-847624 Share on other sites More sharing options...
cltn77 Posted June 3, 2009 Share Posted June 3, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/160009-mssql_connect-failing-on-localhostwindows-xp/#findComment-848225 Share on other sites More sharing options...
stockton Posted June 3, 2009 Author Share Posted June 3, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/160009-mssql_connect-failing-on-localhostwindows-xp/#findComment-848355 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.