Database

PHP5 ORACLE instantclient

Jack Moon 2012. 10. 8. 16:12

PHP5 ORACLE instantclient

PHP 5 에서 부터는 configure 옵션이 바뀌었네요. 이것때문에 삽질 좀 했습니다.

PHP 5.1.2 부터 바뀌었다는 하시는 분도 계시고 하여튼 그 이후 버전 사용하시는 분들 참고하세요. (사용버전 5.1.6)


http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
여기 주소로 가서
instantclient-basic-linux32-10.2.0.3-20061115.zip
instantclient-sdk-linux32-10.2.0.3-20061115.zip
위의 두개의 파일을 받아서 업로드 (위치 /usr/lib)

 

  1. cd /usr/lib
  2. unzip instantclient-basic-linux32-10.2.0.3-20061115.zip 
  3. unzip instantclient-sdk-linux32-10.2.0.3-20061115.zip
  4. mv instantclient_10_2/ oracle/

 

php 컴파일시 libclntsh.so 파일이 없다는 에러를 막기위해 해당디렉토리로 이동한 후
심볼릭 링크를 걸어주었습니다. (저는 링크 만들지 않았는데 에러 없었습니다.)
# cd /usr/lib/oracle
# ln -s libclntsh.so.10.1 libclntsh.so

 

 

오라클 환경변수를 셋팅해줍니다

# vi /etc/profile
HOSTNAME=`/bin/hostname`
HISTSIZE=1000i

# oracle
LD_LIBRARY_PATH="/usr/lib/oracle"
TNS_ADMIN=/usr/local

NLS_LANG=AMERICAN_AMERICA.KO16MSWIN949

 

>>  NLS_LANG은 오라클 서버쪽과 동일하게 설정한다. 만약 그렇지 않을 경우 한글이 물음표로 나타난다.

 

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC LD_LIBRARY_PATH TNS_ADMIN NLS_LANG

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "$PS1" ]; then
            . $i
        else
            . $i >/dev/null 2>&1
        fi
    fi
done


# source /etc/profile

 

 

 

 

php 를 재컴파일합니다. php를 컴파일 하실때
이전 --with-oci8-instant-client=/usr/lib/oracle    5.1.2 이후  --with-oci8=instantclient,/usr/lib/oracle

 

yum remove php
yum install httpd-devel
yum install bzip2-devel
yum install curl-devel

 

configure 에러시 http://aporia.springnote.com/pages/5464879 참조

 
'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/sbin/apxs' '--with-config-file-path=/etc' '--with-mysql' '--with-gd' '--with-zlib' '--with-freetype-dir' '--with-png-dir' '--with-jpeg-dir' '--with-iconv' '--with-bz2' '--with-curl' '--with-gettext' '--with-openssl' '--with-libxml-dir' '--with-xml' '--with-oci8=instantclient,/usr/lib/oracle/' '--enable-ftp' '--enable-calendar' '--enable-gd-native-ttf' '--enable-magic-quotes' '--enable-mod-charset' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-zip' '--enable-sysvmsg' '--disable-debug'
make
make install

 

확인

phpinfo() 에서 보시면 OCI8 섹션이 생기고

OCI8 Support enabled

 

 


 

 

'Database' 카테고리의 다른 글

mysql-bin 로그  (0) 2013.12.10
TOAD EXPLAIN PLAN 설정  (0) 2012.10.08
Oracle SQLPLUS 에서 백스페이스를 눌러 글자 지우기  (0) 2012.10.08
Oracle Instantclient (window 설치)  (0) 2012.10.08
Oracle characterset  (0) 2012.10.08