php支持sql server么,安装PHP 连接SQL Server支持

有时候我们需要PHP连接SQL Server,在Windows平台下可以直接连,而在Unix/Linux下如何连接呢?因为Unix/Linux下没有SQL Server的驱动,那么我们就需要安装驱动,这个驱动就是FreeTDS——Unix/Linux下的Sybase/SQL Server驱动。

完整的安装步骤如下:

1、下载安装FreeTDS(目前最新稳定版本是0.82)

写道

wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-0.82.tar.gz

tar zxvf freetds-0.82.tar.gz

cd freetds-0.82

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

make

make install

2、重新编译PHP 5.2.11

写道

wget http://www.php.net/get/php-5.2.11.tar.gz/from/this/mirror

wget http://php-fpm.org/downloads/php-5.2.11-fpm-0.5.13.diff.gz

tar zxvf php-5.2.11.tar.gz

gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11 -p1

cd php-5.2.11/

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --disable-ipv6 --without-pear --with-sybase=/usr/local/freetds

make ZEND_EXTRA_LIBS='-liconv'

make install

第三步:配置freetds

vim /usr/local/freetds/etc/freetds.conf

具体配置见该文件中的说明

例:

[sqlserver]

host = sql_server_name_or_host_ip

port = 1433

tds version = 7.0

第四步:配置phpini文件

找到

;extension=mssql70.so

将注释;去掉成

extension=mssql70.so

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值