[리눅스] freetds설치 및 php 연동하기
- 공유 링크 만들기
- 이메일
- 기타 앱
[리눅스] freetds설치 및 php 연동하기
카페24 서버호스팅 Guide
freetds설치 및 php 연동하기
freetds설치 및 php 연동하기
# 설치환경
- CentOS 5.x (64bit)
- php-5.2.17
- freetds-0.91
설치 위치 : /usr/local/freetds
1. freetds 설치
- freetds 스테이블 버전을 다운로드 한 후 설치한다.
[root@cafe24 src]# wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
[root@cafe24 src]# tar zxvf freetds-stable.tgz
[root@cafe24 src]#
[root@cafe24 src]# cd freetds-0.91
[root@cafe24 freetds-0.91]# ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --disable-odbc --disable-debug --enable-dbmfix --enable-msdblib
.
.
.
.
config.status: creating win32/version.rc
config.status: creating win32/freetds.nsh
config.status: creating vms/Makefile
config.status: creating include/config.h
config.status: include/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
[root@cafe24 freetds-0.91]# make && make install
.
.
.
.
make[2]: Entering directory `/root/src/freetds-0.91'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ./mkinstalldirs /usr/local/freetds/etc
if test ! -f /usr/local/freetds/etc/freetds.conf; then
/usr/bin/install -c -m 644 ./freetds.conf /usr/local/freetds/etc/freetds.conf;
fi
if test ! -f /usr/local/freetds/etc/locales.conf; then
/usr/bin/install -c -m 644 ./locales.conf /usr/local/freetds/etc/locales.conf;
fi
make[2]: Leaving directory `/root/src/freetds-0.91'
make[1]: Leaving directory `/root/src/freetds-0.91'
[root@cafe24 freetds-0.91]#
[root@cafe24 freetds-0.91]#
2. phpize를 이용하여 모듈 생성
- php 설치 원본 소스 디렉토리로 이동한 다음과 같이 phpize를 이용하여 모듈을 생성한다.
[root@cafe24 freetds-0.91]# cd /root/src/php-5.2.17/ext/mssql/
[root@cafe24 mssql]# /home/APM/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
[root@cafe24 mssql]#
[root@cafe24 mssql]# ./configure --with-mssql=/usr/local/freetds/ --with-php-config=/home/APM/php/bin/php-config
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
[root@cafe24 mssql]# make
--------------------------------------------------------------------------------------------------
Libraries have been installed in:
/root/src/php-5.2.17/ext/mssql/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
--------------------------------------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'. [root@cafe24 mssql]# make install Installing shared extensions: /home/APM/php/lib/php/extensions/no-debug-non-zts-20060613/ [root@cafe24 mssql]#
3. php.in 파일에 모듈 등록
- php.ini 파일 가장 하단에 다음과 같이 추가합니다.
[root@cafe24 mssql]# vi /home/APM/apache/conf/php.ini
--------------------------------------------------------------------------------------------------
[freetds]
extension_dir=/home/APM/php/lib/php/extensions/no-debug-non-zts-20060613 <-- 추가합니다.
extension="mssql.so"
--------------------------------------------------------------------------------------------------
[root@cafe24 mssql]# php -m
[PHP Modules]
bcmath
calendar
ctype
curl
date
dba
dbase
dom
eAccelerator
exif
filter
ftp
gd
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mhash
mssql
mysql
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend Optimizer
zlib
[Zend Modules]
Zend Optimizer
eAccelerator
[root@cafe24 mssql]#
from http://blog.cafe24.com/1471 by ccl(S)
- 공유 링크 만들기
- 이메일
- 기타 앱
댓글
댓글 쓰기