PHP4 上安裝 freetds











FreeTDS 是用來在 Unix-like 下連結 SQL SERVER 用的

先安裝 unixODBC-devel 套件
# yum install unixODBC-devel

再來編譯 FreeTDS
# ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --with-unixodbc=/usr

touch 這兩個檔案讓 php compile 過
# touch /usr/local/freetds/include/tds.h
# touch /usr/local/freetds/lib/libtds.a

加入以下參數重新編譯
--with-unixODBC \
--with-mssql=/usr/local/freetds \

編譯完重新啟動 apache 即可

可檢查 phpinfo() 中是否有 mssql 支援

為什麼要 tocuh 咧
可參考這邊


另外再補充一下
php 連結 SQL SERVER 如果遇到亂碼的話
請在 freetds.conf 設定(2010-07-27 修正)

[Somewhere]
host = 111.222.121.212
port = 1433
client charset = UTF-8
tds version = 8.0

如果 MySQL 亂碼請用 set names 'utf-8' 囉~

Comments

Popular posts from this blog

CentOS7 如何新增/移除 Rich Rule for firewalld

mac 安裝 mtr

Howto use Postman test Cors