Linux uses FreeTDS to connect remote servers sqlservser2012

Source: Internet
Author: User
Tags fpm mssql

1. Download: freetds-patched.tar.gz http://www.freetds.org/software.html

Http://www.freetds.org/userguide/choosingtdsprotocol.htm

# TAR-ZXVF Freetds-patched.tar.gz
# CD freetds-1.00.21

Note that this is the--with-tdsver=7.4, this is very important, you need to choose the correct configuration according to your database version, because now mostly SQLserve2008 so need to choose 7.3; This example is connection sqlserver2012, all need to select 7.4.

In fact, refer to the official website of the document to know the problem, but because many people download the old version FreeTDS-0.91, even if set to--with-tdsver=7.4 or above is not used.

#./configure--prefix=/usr/local/freetds--with-tdsver=7.4--enable-msdblib
# Make && make install

2. verifying the FreeTDS version

This step is very important, it can be continued, or the subsequent steps are meaningless.

first look at the version information

Test Database Connectivity

#/usr/local/freetds/bin/tsql-h Database Server ip-p port number-u user name-p password

/usr/local/freetds/bin/tsql-h 106.14.24.155-p 1433-u sa-p hell[email protected]

3. Increase the pdo_dblib of the PHP extension PDO

#cd/USR/LOCAL/SRC/ONEINSTACK/SRC

#tar ZXVF php-5.6.28.tar.gz

#cd php-5.6.28

#cd/ext/pdo_dblib

Using Phpize to add extensions to PHP dynamically under Linux

#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-dblib=/usr/local/freetds/
# Make && make install

Added in php.ini file :extension= "pdo_dblib.so"

4. increase the MSSQL extension

#cd/usr/local/src/oneinstack/src/php-5.6.28/ext/mssql

Using Phpize to add extensions to PHP dynamically under Linux

#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--with-mssql=/usr/local/freetds/
# Make && make install

Added in php.ini file: extension= "mssql.so"
5. Restart Php-fpm,nginx

#service php-fpm Restart.

#service nginx Restart

6. Visit Phpinfo to see if the pdo_dblib extension is installed

Linux uses FreeTDS to connect remote servers sqlservser2012

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.