2013년 8월 16일 금요일

CentOS 5.9 에 PHP 5.3.27 컴파일 설치 하기

PHP 서버를 신규로 구성하던 중 “PHP Fatal error:  Call-time pass-by-reference has been removed in …” 라는 오류가 발생하였다. 기존의 서버에서는 실행에 이상이 없던 것이라 여러가지를 찾던중 php 5.4 version 부터 개발에 새로운 제약 사항이 생겼다는 것을 알고 기존서버와 같은 4.3.27 버전으로 낮추려고 했으나 yum repository 리스트 상에 5.4 이하 버전이 없었다.
인터넷을 뒤적이며 repository를 수정하면 5.3.x 버전으로 Downgrade 시킬 수 있다는 말을 들었으나 실패하여 php.net 사이트에 있는 5.3.27을 다운받아 설치 하기로 했다.
몇가지의 Compile 중 오류는 있었지만 오히려 좀더 수월하게 설치가 된 것 같다. 앞으로도 당분간은 이렇게 설치를 해야 할 것 같아서 미리 기록으로 남겨놓는다.

1.     CentOS 5.9 PHP 5.3.27 Source
II.     소스를 다운로드 받아 서버에 FTP 등을 통하여 전송한다.
III.    tar xvzf php-5.3.27.tar.gz 을 이용하여 압축을 해제 한다.
2.     CentOS 5.9 PHP 5.3.27 Source Compile
./configure --prefix=/usr --with-apxs2=/usr/sbin/apxs --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-gmp --with-mhash --with-ldap --enable-mbstring --with-mysql=/usr/include/mysql/ --with-mysqli --with-openssl --enable-pcntl --with-pdo-mysql --with-zlib-dir --with-pspell --with-readline --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-xmlrpc --enable-zip --with-zlib --with-libdir=lib64
3.     컴파일 완료 후 적용
make && make install
make 명령을 실행 시켰는데 make를 인식하지 못하는 오류가 발생할 경우, make 가 설치되지 않은 경우이다. 이 경우에는 다음과 같이 하면된다.
Yum –y install make
make && make install
4.     php.ini 적용
perl -pi -e 's/register_globals = Off/register_globals = On/g' /etc/php.ini
5.     Apache 재기동
Service httpd restart
6.     CentOS 5.9 PHP 5.3.27 Source Compile 중 각종 Error 해결방법
I.       make: warning:  Clock skew detected.  Your build may be incomplete.
해걸책 : 시간을 동기화 시킨다.
II.     checking for termcap functions library... configure: error: No curses/termcap library found
해결책 :  # yum -y install ncurses-devel
III.    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
해결책 : # yum -y install gcc-c++
IV.    /usr/lib/libdb-4.3.so: could not read symbols: File in wrong format
/usr/lib/libexpat.so: could not read symbols: File in wrong format
해결책 : # mv /usr/lib/libexpat.so /usr/lib/libexpat.so.bak
               # ln -s /lib64/libexpat.so.0.5.0 /usr/lib/libexpat.so
               # mv /usr/lib/libdb-4.3.so /usr/lib/libdb-4.3.so.bak
               # ln -s /lib64/libdb-4.3.so /usr/lib/libdb-4.3.so 
에러의 원인은 64비트 환경에서 32비트용 소스를 가져다가 설치하기
때문이다컴파일 도구와 관련된 심볼릭 링크 파일을 찾지 못한다고 나오고 있다.
V.     configure: error: Unable to locate gmp.h
해결책 : # yum -y install gmp*
VI.    configure: error: not found. Please reinstall the expat distribution.
해결책 : # yum -y install expat*
VII.   configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
해결책 : # yum -y install curl* 또는 yum -y install curl & yum -y install curl-devel
VIII. configure: error: Please reinstall libmcrypt - I cannot find mcrypt.h
configure: error: Please reinstall libmhash - I cannot find mhash.h
해결책 : # yum install libmcrypt libmcrypt-devel libmhash libmhash-devel
IX.    Configure: error: xml2-config not found. Please check your libxml2 installation
해결책 : #yum install libxml2-devel
X.     Checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
해결책 : #yum install openssl-devel
XI.    Configure: error: Please reinstall the BZip2 distribution
해결책 : # yum install bzip2-devel
XII.   Configure: error: libjpeg.(also) not found.
해결책 : # yum install libjpeg-devel
XIII. Configure: error: libpng.(also) not found.
해결책 : yum install libpng-devel
XIV. Configure: error: freetype.h not found.
해결책 : #yum install freetype-devel
XV.   Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
해결책 : # yum install mysql-devel
XVI. Configure: error: Please reinstall the ncurses distribution
해결책 : # yum install ncurses-devel
XVII.                  Checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!
해결책 : # yum install unixODBC-devel
XVIII.                Configure: error: Cannot find pspell
해결책 : # yum install pspell-devel
XIX. Configure: error: snmp.h not found. Check your SNMP installation.
해결책 : yum install net-snmp-devel
XX.   Configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
해결책 : yum install libc-client-devel
XXI. Configure: error: libXpm.(a|so) not found   에러날때
해결책 : yum install xorg-x11-devel
XXII.                  Configure: error: mcrypt.h not found. Please reinstall libmcrypt.   에러날때
해결책 : wget 
http://ftp.linux.co.kr/pub/etc/libmcrypt-2.5.7.tar.gz
    tar zxvfp libmcrypt-2.5.7.tar.gz
    cd libmcrypt-2.5.7
    ./configure && make && make install
XXIII.                Configure: error: png.h not found.
해결책 : yum install libpng-devel
XXIV.                Configure: error: Unable to locate gmp.h
해결책 : yum -y install gmp gmp-devel
XXV.                  configure: error: Cannot find ldap libraries in /usr/lib.
해결책 : cp -frp /usr/lib64/libldap* /usr/lib/
XXVI.                configure: error: Cannot find MySQL header files under /usr/include/mysql/.
A.     해결책 : mysql 용 모듈이 부족하여 발생하는 현상
B.      yum remove mysql 로 기존 설치된 package 삭제
C.      yum install mysql-devel 설치
D.     rpm -qa | grep mysql-devel 로 확인
E.      rpm -q --filesbypkg mysql-devel-5.0.95-5.el5_9 실행
XXVII.               configure: error: mysql configure failed. Please check config.log for more information.
A.     해결책 : --with-libdir=lib64 옵션을 추가한다.
B.      해당 문제는 mysql php bit 수에 따른 문제로 생각된다.
XXVIII.              configure: error: Cannot find pspell
해결책 : yum install pspell-devel
XXIX.                configure: error: Please reinstall readline - I cannot find readline.h
해결책 : yum install readline-devel
XXX. configure: error: Cannot find ldap.h
해결책 : yum –y install libldap2-dev openldap-devel
XXXI.                configure: error: ZLIB extension requires zlib >= 1.0.9
ln -sf /usr/lib64/libgssapi_krb5.so.2.2 /usr/lib/libgssapi_krb5.so
ln -sf /usr/lib64/libkrb5.so.3.3 /usr/lib/libkrb5.so
ln -sf /usr/lib64/libk5crypto.so.3.1 /usr/lib/libk5crypto.so
ln -sf /lib64/libcom_err.so.2 /usr/lib/libcom_err.so
ln -sf /usr/lib64/libgcrypt.so.11 /usr/lib/libgcrypt.so
ln -sf /usr/lib64/libgpg-error.so.0 /usr/lib/libgpg-error.so
ln -sf /usr/lib64/libexpat.so /usr/lib/libexpat.so
ln -sf /usr/lib64/libm.so /usr/lib/libm.so
ln -sf /usr/lib64/libssl.so /usr/lib/libssl.so
apache시작시 아래 에러
Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
 
이건 phpinstall ./configure 옵션에  --enable-maintainer-zts 붙여주면 해결됨.

2013년 7월 30일 화요일

MyBatis 에서 조건절(WHERE)에 IN 이 들어 있는 경우

인터넷을 뒤저보니 IN 절에 들어갈 자료를 쉼표(,) 구분자로 일단받아서 DB의 function을 통하여 수정하는 방법을 구현해놓은 것을 찾았다. 하지만 해당의 경우 DB의 함수를 사용해야 한다는 점이 있어 다른 방법을 강구하던중 약간 삽질을 하기는 했지만 Query가 들어가는 XML에 foreach 문을 사용하여 자료를 넣는 방법을 찾았다 방법은 밑에와 같으며 AND column1 IN ( #{item} ) 간단한 설명을 하자면 자바쪽에서 배열로 IN 절에 들어갈 값들을 만든후 MyBatis에서 위와 같이 item으로 받으면 foreach 문을 통하여 DB 상의 함수가 돌아가지 않고도 MyBatis 쪽에서 AND column1 IN ('1', '2', '3') 와 같은 결과를 얻을 수 있다.

2013년 4월 14일 일요일

자바를 이용한 프로젝트 만들기

조금은 여유시간이 남아서 무엇을 할까 고민하다가 내가 할줄 아는 것들을 정리하던중

PHP로 된 제로보드와 같은 내용을 Java로 구현 하여 이를 이용한

Web Site를 하나 만들어보려고 한다.

현재는 Architecture 설계중....

대단한 것은 아니지만 그동안 배웠던 개발 및 설계 기술들을 동원하여

만들어볼까 한다.

더불어, 영어 작문능력 향상을 위하여 되도록 영어로도 작성하고자 한다.


Nowadays, I have free time, because my work finish early.

I got bad feeling for time that doesn't do anything, so I decide make a Web Site.

I made a plan for it and build architecture.

My goal will make a Web Site Core by modulation.