Linux compile MSSQL extensions use PHP connection sqlserver2008 steps _mssql2008

Source: Internet
Author: User
Tags mssql

1, installation configuration FreeTDS

Copy Code code as follows:

wget http://mirrors.xmu.edu.cn/ubuntu/archive/pool/main/f/freetds/freetds_0.82.orig.tar.gz
Tar zxf freetds_0.82.orig.tar.gz
CD freetds_0.82
./configure--prefix=/sxmobi/software/common/freetds--enable-msdblib
Make && make install

2, the compilation MSSQL extension, assumes the PHP installs the source code package for/usr/local/src/php-5.3.1

1 Enter the module source directory, >cd/sxmobi/web/softbak/php-5.3.13/ext/mssql
2 generate the compilation configuration file, >/sxmobi/software/webserver/php/bin/phpize
3) installation, >./configure--with-php-config=/sxmobi/software/webserver/php/bin/php-config--with-mssql=/sxmobi/ Software/common/freetds
4) >make
5) >make Install
6 Copy the generated mssql.so module to the extended directory of PHP, modify php.ini, add the MSSQL module

Note:
When compiling a configuration, you may encounter errors that cannot be found FreeTDS: Configure:error:directory/usr/local/freetds is not a FreeTDS installation Directory, According to the official explanation http://www.freetds.org/news.html
, PHP detects some files to determine if FreeTDS is installed, and because the new FreeTDS no longer installs these files, PHP compilation fails. Only two empty files can be created. As follows:
>touch/usr/local/freetds/include/tds.h
>touch/usr/local/freetds/lib/libtds.a

3. Modify/etc/freetds/freetds.conf

Copy Code code as follows:

[server2008]
Host = 192.168.0.109
Port = 1433
TDS Version = 7.0
Client CharSet = UTF8



4. Test connection

Copy Code code as follows:

./tsql-s 192.168.0.109-u User name-p password-d database
If you can see 1> the connection is successful
Enter SQL statement
1>select * FROM table;
2>go

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.