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"