Jump to content

[SOLVED] Connection to MsSQL Server


RossM

Recommended Posts

Hi People,

 

This problem is doing my nut! I am trying to get a connect to my MsSQL server however it keeps erroring.

 

I ahve tried the code:

<?php
function customError($errno, $errstr)
{
        echo "<b>Error:</b> [$errno] $errstr";
}

set_error_handler("customError");
mssql_connect("sqlserver", "username", "password");
?>

 

But says [2] mssql_connect() [function.mssql-connect]: Unable to connect to server: sqlserver

 

Anyone have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/147763-solved-connection-to-mssql-server/
Share on other sites

Hi,

 

Thanks for the replies.

 

The sql server is on a remote machine within the same network. I tried [servername], [servername].domain.com and the ip address of the server and still says cannot connect.

 

The sql server doesn't have an instance name. Any other suggestions?

 

Thanks,

Ross

Figured it out. For future reference, this is how I did it:

 

- Download the newest version of ntwdblib.DLL (version 2000.80.194.0 or greater to connect to SQL 2003 or higher)

- In the php.ini file, make sure mssql.secure_connection is off if you want to use sql authentication

- Reboot the server

- Done!

Archived

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

×
×
  • 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.