Install the dblib extension in php to connect to mssql

Source: Internet
Author: User
The following section describes how to install the dblib extension in php and connect to mssql. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the following small series for you to install dblib extensions in php and connect to mssql. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at it with Xiaobian.

1. install freetds and then modify the configuration file.

If version 0.82 is not installed, compilation failure will be reported.

Compile Failure With freetds0.82

Go to the freetds directory to compile and install

./configure --prefix=/usr/local/freetds --enable-msdblib --enable-sybase-compat   --disable-threadsafemakemake install

2. install mssql again

Go to the directory to compile and install

/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetdsmakemake install

3. reinstall dblib

Go to the directory to compile and install

/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-dblib=/usr/local/freetdsmakemake install

4. modify php. ini

extension=mssql.soextension=pdo_dblib.so

Tsql client connection command

/usr/local/freetds/bin/tsql -H 192.168.1.100 -p 1433 -U sa -P 123456 -D user

Modify configuration file

/Usr/local/freetds/etc/freetds. conf configuration file location tds version = 8.0 // modify client charset = UTF8 // add

If the database cannot be connected, check the version and set the global option in/usr/local/freetds/etc/freetds. conf to "tds version = 8.0 ".

If the result is garbled, change/usr/local/freetds/etc/freetds. conf to add a client charset = UTF8 to global.

Adaptive Server is unavailable or does not exist "error connecting to SQL Server from PHP is caused by no port

Add a port or you cannot connect to it.

'Dblib: host = 192.168.8.888: 1433; dbname = xxxx'

The above section describes how to install the dblib extension in php and connect to mssql. For more information, see The PHP Chinese website (www.php1.cn )!

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.