Skip to Content.
Sympa Menu

freetds - [freetds] php unable to connect ms sql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James liu" <liuping.james AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] php unable to connect ms sql
  • Date: Wed, 28 Mar 2007 09:22:38 +0800

FreeBSD 6 php5.21
mssql 2k(with sp4) in winxp

phpinfo show mssql is ok (in FreeBSD6)

i use shell "export TDSVER=7.0 tsql -H...." , it can work.

i use another pc(winxp+php) connect is ok.

i use php
<?php
putenv("/usr/local/freetds/etc/freetds.conf");
$dbhost = "192.168.7.12";
$dbname = "db";
$dbpass = "123123";
$dbuname = "t";

$con = mssql_connect($dbhost, $dbuname, $dbpass);
$ret = mssql_select_db($dbname);
$sql = " select top 10 IdxID as id, Topic as posttopic from
tt.dbo.PostsT
$result = mssql_query($sql);

while($row = mssql_fetch_array($result)){
echo "ID:".$row['id']."name:".$row['posttopic'];
}

?>

when php testSqlServer.php,,,it show me
"Unable to connect server: 192.168.7.12"

freetds.conf(something modified):
[MyServer2K]
host = 192.168.7.12
port = 1433
tds version = 7.0



anyone know how to fix it?



--
regards
jl




Archive powered by MHonArc 2.6.24.

Top of Page