Connect to mssql in linux + php

Source: Internet
Author: User

Linux + php connection to mssql due to environment requirements
The installation and loading of the freetds module is omitted from the Internet.
 
Yum install unixODBC *
In/etc/profile
Add export PATH = "$ PATH:/usr/local/freetds/bin"
# Echo "/usr/local/freetds/lib">/etc/ld. so. conf
Source/etc/profile
# Ldconfig
 
Configure freetds again
/Usr/local/freetds/etc
[Root @ xafcbackup etc] # cat freetds. conf
# $ Id: freetds. conf, v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# Name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# See the freetds. conf manpage "man freetds. conf ".
# Global settings are overridden by those in a database
# Server specific section
[Global]
# TDS protocol version
; Tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (Setting this to/tmp is insecure on a multi-user system)
; Dump file =/tmp/freetds. log
; Debug flags = 0 xffff
# Command and connection timeouts
; Timeout = 10
; Connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# Is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
Text size = 64512
; Client charset = UTF-8
# A typical Sybase server
# A typical Microsoft server
[EgServer70]
Host = 51.102.111.123
Port = 1433
Tds version = 8.0
 
[Root @ xafcbackup etc] # cat/data/caijishuju/t. php
<? Php
$ Conn = mssql_connect ("egServer70", "sa", xaj! @ 34 );
// Test
If ($ conn)
{
Echo "OK ";
} Else

{
Echo "no ";
}
?>
 
The program configuration file connects to the defined name rather than the ip address. Otherwise, it cannot be connected!
Author: "linux"

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.