Linux-linked SQL Server database-driven installation

Source: Internet
Author: User
Tags fpm zts

1. FreeTDS must be installed

Installing the Pdo_dblib extension requires the installation of FreeTDS first.

FreeTDS's latest stable version is 0.91, this can be downloaded on the official website http://www.freetds.org/, can also be downloaded in http://download.csdn.net/detail/DLUTXIE/3663528

Download FreeTDS

wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz

Tar zxf freetds-stable.tgz

CD freetds-stable/

/usr/bin/phpzie

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

Make && make install

To configure the FreeTDS configuration file:

Host fills SQL Server address

Port Fill Ports

Tds version=8.0

Client charset = UTF8

3. Installing the Php_dblib module

/usr/local/php5/bin/phpize

Linking databases via Pdo_dblib

--with-pdo-dblib path refers to the installation path of the FreeTDS

./configure--with-php-config=/usr/local/php5/bin/php-config--with-pdo-dblib=/usr/local/freetds

Make

Make install

Add extension=pdo_dblib.so to the php.ini.

Then restart Nginx and PHP-FPM

[Email protected] no-debug-non-zts-20121212]#/etc/init.d/nginx restart

[Email protected] no-debug-non-zts-20121212]#/etc/init.d/php-fpm restart

See if there are pdo_dblib extensions in Phpinfo

4.pdo when connecting to the database:

Remember to use DBLIB instead of SQL Server

<?php

try{

$link =new PDO ("Dblib:host=souyue91;dbname=dbname", "Dbuser", "Dbpass");

}catch (Pdoexception $e) {

echo $e->getmessage ();

}

The host is filled with FreeTDS souyue91.

Linux-linked SQL Server database-driven installation

Related Article

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.