linux php mssql 연동
Tagged in , and posted in Practice

(1) FreeTDS 설치

# wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

# tar xvzf freetds-stable.tgz

# cd freetds-0.91

# ./configure –prefix=/usr/local/freetds –with-tdsver=8.0 –disable-odbc –disable-debug –enable-msdblib

# make && make install

 

(2) freetds.conf 설정 및 ms-sql 접속 Test

# vi /usr/local/freetds/etc/freetds.conf

 

– 아래의 항목 추가

[TestMSSQL]
host = IP주소
port = 1433
tds version = 8.0
client Charset = UTF-8
* tds version : 접속 하고자 하는 SQL Server 버젼에 맞게 수정.
(3) MS-SQL 접속 테스트

# /usr/local/freetds/bin/tsql -H ip주소 -p 1433 -U db계정 -P 비밀번호
(4) mssql 모듈 설치

# cd /usr/local/src/php-5.2.9/ext/mssql

# /usr/local/php/bin/phpize

# ./configure –with-mssql=/usr/local/freetds –with-php-config=/usr/local/php/bin/php-config

# make

# cp .libs/mssql.so /PHP Extension 디렉토리

# vi /usr/local/php/lib/php.ini
extension=mssql.so <—- 추가

# apache 재구동
(5) 모듈 설치 확인 – phpinfo의 mssql 항목 확인 및 php -i 옵션으로 확인

# /usr/local/php/bin/php -i | grep mssql
mssql
mssql.allow_persistent => On => On
mssql.batchsize => 0 => 0
mssql.charset => no value => no value
mssql.compatability_mode => Off => Off
mssql.connect_timeout => 5 => 5
mssql.datetimeconvert => On => On
mssql.max_links => Unlimited => Unlimited
mssql.max_persistent => Unlimited => Unlimited
mssql.max_procs => Unlimited => Unlimited
mssql.min_error_severity => 10 => 10
mssql.min_message_severity => 10 => 10
mssql.secure_connection => Off => Off
mssql.textlimit => Server default => Server default
mssql.textsize => Server default => Server default
mssql.timeout => 60 => 60

 

 

출처 : http://faq.hostway.co.kr/Linux_WEB/1261

One Comment so far:

  1. master says:

    cd php소스경로/ext/pdo_dblib/
    phpize
    ./configure –with-mssql=/usr/local/freetds –with-pdo-dblib=/usr/local/freetds
    make;make install

Leave your Comment

Your email address will not be published. Required fields are marked *