十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
本文操作環(huán)境:linux5.9.8系統(tǒng)、php-5.2.17版、DELL G3電腦

怎么增加php mssql擴(kuò)展?
php安裝mssql擴(kuò)展
關(guān)于freetds編譯時(shí)with-tdsver參數(shù)
在FreeTDS 1.1版本之后,可以設(shè)置為auto,版本之前需要手動(dòng)指定。
以前寫過mssql模塊安裝,這次只是補(bǔ)充編譯freetds時(shí)指定with-tdsver參數(shù)
1、下載freetds及php源碼包
[root@VM_0_11_centos ~]# wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.1.21.tar.gz [root@VM_0_11_centos ~]# wget -c http://museum.php.net/php5/php-5.2.17.tar.gz
2、安裝freetds
# 解壓freetds源碼包
[root@VM_0_11_centos ~]# tar zxvf freetds-1.1.21.tar.gz [root@VM_0_11_centos ~]# cd freetds-1.1.21/
# 開始編譯安裝
[root@VM_0_11_centos ~]# ./configure --prefix=/usr/local/freetds --with-tdsver=7.3 --enable-msdblib [root@VM_0_11_centos ~]# make && make install
3、編譯mssql模塊
# 解壓php源碼包
[root@VM_0_11_centos ~]# tar zxvf php-5.2.17.tar.gz
# 進(jìn)入mssql擴(kuò)展目錄
[root@VM_0_11_centos ~]# cd php-5.2.17/ext/mssql/
# 生成configure
[root@VM_0_11_centos mssql]# /www/server/php/52/bin/phpize
# 開始編譯
[root@VM_0_11_centos php-5.2.17]# ./configure --with-php-config=/www/server/php/52/bin/php-config --with-mssql=/usr/local/freetds [root@VM_0_11_centos php-5.2.17]# make && make install
4、編輯php.ini文件,加入mssql擴(kuò)展,在 491 行下面添加(如果不會(huì)用vi編輯器,可直接將文件下載改完再傳上去)
[root@VM_0_11_centos ~]# vi /www/server/php/52/etc/php.ini extension_dir = "/www/server/php/52/lib/php/extensions/no-debug-non-zts-20060613/" extension = mssql.so # 新增行
保存退出,重啟php或者重啟服務(wù)器。