`
wgllz
  • 浏览: 109815 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

安装PHP 连接SQL Server支持

    博客分类:
  • PHP
阅读更多

有时候我们需要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 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics