日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

php编译freetds,Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记

發布時間:2024/7/19 linux 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php编译freetds,Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

CentOS 5.4 Linux 下的 PHP(FastCGI) 需要連接相關部門的SQL Server 2000數據庫,配置了擴展FreeTDS擴展。

1、編譯安裝FreeTDS

mkdir -p /data0/software/

cd /data0/software/

wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

tar zxvf freetds-stable.tgz

cd freetds-0.82/

./configure --prefix=/usr/local/webserver/freetds --with-tdsver=8.0 --enable-msdblib

make && make install

cd ../

echo "/usr/local/webserver/freetds/lib/" > /etc/ld.so.conf.d/freetds.conf

ln -s /usr/local/webserver/freetds/lib/libsybdb.so.5.0.0 /usr/local/webserver/freetds/lib/libsybdb.so.4

/sbin/ldconfig

rm -f /usr/local/webserver/freetds/etc/freetds.conf

vi /usr/local/webserver/freetds/etc/freetds.conf

輸入以下內容:

引用

[global]

# TDS protocol version

;?????? tds version = 4.2

# Whether to write a TDSDUMP file for diagnostic purposes

# (setting this to /tmp is insecure on a multi-user system)

;?????? dump file = /tmp/freetds.log

;?????? debug flags = 0xffff

# Command and connection timeouts

;?????? timeout = 10

;?????? connect timeout = 10

# If you get out-of-memory errors, it may mean that your client

# is trying to allocate a huge buffer for a TEXT field.

# Try setting 'text size' to a more reasonable limit

text size = 64512

host = mssql.yourdomain.com

port = 1433

tds version = 8.0

client charset = UTF-8

2、編譯安裝PHP自帶MSSQL擴展

進入本地已存在的php-5.2.XX源碼包目錄:

cd /data0/software/php-5.2.XX/ext/mssql/

/usr/local/webserver/php/bin/phpize

./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-mssql=/usr/local/webserver/freetds/

make && make install

3、在php.ini配置文件中增加mssql.so

vi /usr/local/webserver/php/etc/php.ini

增加一行:

引用

extension = "mssql.so"

4、重啟PHP FastCGI

/usr/local/webserver/php/sbin/php-fpm restart

5、測試文件(test_mssql.php):

總結

以上是生活随笔為你收集整理的php编译freetds,Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。