Configure PHP extension MSSQL under Linux

Source: Internet
Author: User
Tags mssql

Introduction: Linux Under the configuration of PHP extension MSSQL, so that PHP through the MSSQL tool implementation and remote win SQL Server data transfer.

There are two ways of doing this:

One, the first time to compile PHP to provide MSSQL support, that is, the compilation parameters to add--with-mssql=/path

Second, for the installation of PHP, you need to take MSSQL as a module, compiled PHP to support it, this article mainly explains this method:

1. Installation Configuration FreeTDS

Download the source package and compile the installation

#wget tp://ibiblio.org/pub/linux/alpha/freetds/stable/freetds-stable.tgz
#tar-zxvf freetds-stable.tgz#cd freetds-freetds-0.91/#./configure--prefix=/usr/local/freetds--enable-msdblib# Make#make Install

2. Re-add PHP to support the MSSQL module

1) Enter the source code directory of PHP (the source code package extracted from the PHP directory)

#cd ~/php-5.5.13/ext/mssql/

2) Execute phpize generate compile config file (Phpize is used to extend PHP extension module, through phpize can build PHP plug-in module)

#/usr/local/php/bin/phpize

3) Recompile

#./configure--with-php-config=/usr/local/php/bin/php-config--with-mssql=/usr/local/freetds/#make #make Install

4) See instructions to install the module successfully and open the module in php.ini as shown in the path

650) this.width=650; "title=" Figure II "alt=" Wkiom1phbiazrxbpaabousv9zu8976.jpg "src=" http://s3.51cto.com/wyfs02/M01/44/ 58/wkiom1phbiazrxbpaabousv9zu8976.jpg "/>

3, modify the freetds.conf

#vim/usr/local/freetds/etc/freetds.conf[server2008]host = 10.32.22.100port = 1433tds Version = 7.0client charset = UTF8

3, verify (do not need to restart PHP-FPM)

#php-M | grep mssqlmssql

4. Test connection

650) this.width=650; "title=" Figure three "alt=" Wkiom1phbzdc4ghzaafz-sfpldy984.jpg "src=" http://s3.51cto.com/wyfs02/M02/44/ 58/wkiom1phbzdc4ghzaafz-sfpldy984.jpg "/>

Note: Due to version may be error, you need to use tdsver=7.0 to specify the version.

This article is from the "Linux_ ant" blog, please make sure to keep this source http://onlyoulinux.blog.51cto.com/7941460/1536188

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.