Jump to content

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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