欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux編譯mssql擴(kuò)展使用php連接sqlserver2008的使用步驟

 更新時(shí)間:2013年11月28日 16:02:58   作者:  
這篇文章主要介紹了Linux下php連接sqlserver2008的使用步驟,大家參考使用吧

1、安裝配置freetds

復(fù)制代碼 代碼如下:

wget http://mirrors.xmu.edu.cn/ubuntu/archive/pool/main/f/freetds/freetds_0.82.orig.tar.gz
tar zxf freetds_0.82.orig.tar.gz
cd freetds_0.82
./configure --prefix=/sxmobi/Software/common/freetds --enable-msdblib
make && make install
 

2、編譯mssql擴(kuò)展,假設(shè)PHP安裝源碼包為/usr/local/src/php-5.3.1

1) 進(jìn)入模塊源碼目錄,>cd /sxmobi/web/softbak/php-5.3.13/ext/mssql
2) 生成編譯配置文件,>/sxmobi/Software/webserver/php/bin/phpize
3) 安裝,>./configure --with-php-config=/sxmobi/Software/webserver/php/bin/php-config --with-mssql=/sxmobi/Software/common/freetds
4) >make
5) >make install
6) 把生成的mssql.so模塊復(fù)制到PHP的擴(kuò)展目錄,修改php.ini,加入mssql模塊

注:
在編譯配置的時(shí)候可能會(huì)遇到找不到FreeTDS的錯(cuò)誤:configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory,按照官方的解釋http://www.freetds.org/news.html
,PHP檢測(cè)一些文件以確定FreeTDS是否安裝,由于新版的FreeTDS不再安裝這些文件,導(dǎo)致PHP編譯失敗。只需建立兩個(gè)空文件即可。如下:
>touch /usr/local/freetds/include/tds.h
>touch /usr/local/freetds/lib/libtds.a

3、修改/etc/freetds/freetds.conf

復(fù)制代碼 代碼如下:

[server2008]
        host = 192.168.0.109
        port = 1433
        tds version = 7.0
    client charset = utf8
 


 
4、測(cè)試連接
 
 
復(fù)制代碼 代碼如下:

./tsql -S 192.168.0.109 -U 用戶名 -P 密碼 -D 數(shù)據(jù)庫(kù)
如果可以有看到1>說(shuō)明連接成功
輸入sql語(yǔ)句
1>select * from table;
2>go

相關(guān)文章

最新評(píng)論