yum install php-mssql

yum install freetds


vi /etc/freetds.conf


[TDS]

host = <ip of the Server with Sql>
port = 1433
tds version = 8.0

client charset = UTF-8                #한글 문제 발생시


Note: If you use SQL 2000 then tds version = 8.0, if you use SQL 7.0 then tds version = 7.0


conf 안에 샘플이 있음.




 tsql -H <ip> -p 1433 -U <id> -P <pw>


로 연결 테스트



실제 php 코드

connnect.php

<?

     $con = mysql_connect("TDS, "id", "pwd") 

          or die("Could not connect");

     echo ("Connected Successfully");


$sql = "select count(*) from data";

$rs = mssql_query($sql, $con);

echo "result";

echo mssql_result($rs, 0, 0);

     mysql_close($con);

     ?>


연결 테스트


http://webscholar.net/2008/02/19/php-mssql-freetds/

http://blog.naver.com/PostView.nhn?blogId=leons78&logNo=130086441995


한글 문제



Posted by [czar]
,