NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP and MSSQL 7

Joseph Crawford codebowl at gmail.com
Mon Dec 20 14:55:24 EST 2004


Hello Everyone,

i have been trying to use the MSSQL functions in PHP and i cannot get
it to connect i keep getting the error that mssql_connect cannot
connect to the host.

$link = mssql_connect("207.76.168.21", $dbinfo['user'], $dbinfo['pass']);

that is the connection string i was using
and this is the error recieved

Warning: mssql_connect(): Unable to connect to server: 207.76.168.21
in /htdocs/data.php on line 9

I read the docs and noticed a user comment about using freetds, i$link
= mssql_connect("207.76.168.21", $dbinfo['user'], $dbinfo['pass']);
added a server to my freetds.conf file which was found in /etc/ and
then i restarted apache, i changed my mssql_connect to look like this

$link = mssql_connect("MyServer70", $dbinfo['user'], $dbinfo['pass']);

when i use this, i get the same error except the hostname is now
MyServer70 rather than the IP address of the server, here is what i
have in my freetds config

# A typical Microsoft SQL Server 7.0 configuration	
[MyServer70]
	host = 207.76.168.21
	port = 1433
	tds version = 7.0

after adding that i restarted my xampp apache install and i get this error

Warning: mssql_connect(): Unable to connect to server: MyServer70 in
/htdocs/data.php on line 9

am i doing something wrong or is this generally hard to accomplish
from a linux to windows server connection?

-- 
Joseph Crawford Jr.
Codebowl Solutions
codebowl at gmail.com



More information about the talk mailing list