Connect php to sqlserver2000 in linux

Source: Internet
Author: User
In linux, connect php to sqlserver2000-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Connect php (4.x) to the SQL Server database on a linux machine

Apt-get install php-odbc unixODBC-devel unixODBC

Or

Yum install php-odbc unixODBC-devel unixODBC

Then from here (http://ibiblio.org/pub/Linux/ALP.../freetds-stable.tgz) The current freetds source code

Cd/tmp

Wget http://ibiblio.org/pub/Linux/ALP.../freetds-stable.tgz

Tar xzvf freetds-stable.tgz

Cd freetds -*

./Configure? Prefix =/usr/local/freetds? With-tdsver = 8.0? With-unixodbc =/usr

(Because it is connected to SQL server2000, we use "? With-tdsver = 8.0 ")

Make; make install

Vim/usr/local/freetds/etc/tds. driver. template

Insert in file:

[FreeTDS]
Description = v0.64 with protocol v8.0
Driver =/usr/local/freetds/lib/libtdsodbc. so

(The freetds version here is 0.64)

Then install the driver

Odbcinst-I-d-f/usr/local/freetds/etc/tds. driver. template

Create a dsn.

Vim/usr/local/freetds/etc/tds. datasource. template

Content:

[MSSQLTestServer]
Driver = FreeTDS
Description = test sample database
Trace = No
Server = 192.168.1.1
Port = 1433
Database = testdb

Then

Odbcinst-I-s-f/usr/local/freetds/etc/tds. datasource. template-l

Restart apache

Now php supports connecting to the SQL Server database.
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.