Linux uninxODBC SQL Server Native Client 11.0 한글문제 - http://www.opens.kr/35
※ SQL Server Native bind 처리도 문제있는 듯하다 ㅠㅠ
※ FreeTDS bindValue 쓰면 되는 것 처럼 보이는 데
실제 SQL Server Profiler 해보면 prepare statement bind 안되어서 들어온다ㅠㅠ;;
PHP5.3/5.4/5.5 Yum 설치 - http://www.opens.kr/33 으로 PHP 설치 사용했다면
그냥 yum install php55w-mssql 만 설치하면 자동으로 설치가 다 된다.
1) 설치
$ yum install php55w-mssql ================================================================================== Package Arch Version Repository Size ================================================================================== Installing: php55w-mssql x86_64 5.5.12-1.w6 Installing for dependencies: freetds x86_64 0.91-2.el6 php55w-pdo x86_64 5.5.12-1.w6 unixODBC x86_64 2.2.14-12.el6_3 Transaction Summary ================================================================================== Install 4 Package(s)
2) 접속 테스트 아래 링크에 tsql / isql 이용해서 하면된다.
리눅스 unixODBC FreeTDS 설치 (MSSQL) - http://www.opens.kr/36
3) 글로벌 설정
$ vi /etc/freetds.conf ------------------------ [global] tds version = 8.0 client charset = UTF-8 text size = 64512 timeout = 10 connect timeout = 10 ------------------------
※ TDS protocol 버전정보와 자세한 옵션 정보는 아래 freetds 사이트 가이드 참조하면 된다.
http://www.freetds.org/userguide/choosingtdsprotocol.htm
http://www.freetds.org/userguide/
4) PHP PDO에서 접속예시
01 | $dsn = 'dblib:host=192.168.0.0;dbname=DBNAME' ; |
02 | $user = "user_id" ; |
03 | $password = "user_password" ; |
04 |
05 | try { |
06 | $dbh = new PDO( $dsn , $user , $password ); |
07 | } catch (PDOException $e ) { |
08 | echo $e ->getMessage(); |
09 | } |
10 | $sQuery = "select * from sysobjects where xtype = 'U'" ; |
11 | $sth = $dbh ->prepare( $sQuery ); |
12 | $sth ->execute(); |
13 | $result = $sth ->fetchAll(PDO::FETCH_ASSOC); |
14 | print_r( $result ); |