본문 바로가기

Develop/Linux

[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 3

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

이제 마지막.. PHP 설치를 진행하자.
혹 아직 Apache나 MySQL을 설치하지 않았다면 아래 포스트를 먼저 진행하고 오자.

[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 1 http://jguru-study.tistory.com/29
[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 2 http://jguru-study.tistory.com/30


1. 빌드 환경 설정

yum install -y libjpeg libjpeg-devel libjpeg-turbo-devel gd gd-devel gdbm-devel php-mbstring libexif-devel libmcrypt libmcrypt-devel libvpx libvpx-devel libXpm libXpm-devel icu libicu libicu-devel t1lib t1lib-devel gmp-devel mhash* gettext gettext-devel libtidy libtidy-devel libxslt libxslt-devel libedit-devel libc-client libc-client-devel pam-devel readline-devel libpng libpng-devel krb5-devel db4-devel expat*

1-1. libmcrypt & libmcrypt-devel 패키지 설치

CentOS에서는 위 패키지가 yum에 포함되어있지 않아 직접 설치해야 한다. Ubuntu는 확인하지 못했는데 apt-get으로 된다면 그렇게 설치하면 된다.

cd /usr/local/src
wget http://elders.princeton.edu/data/puias/unsupported/6/x86_64/libmcrypt-2.5.8-9.puias6.x86_64.rpm
wget http://elders.princeton.edu/data/puias/unsupported/6/x86_64/libmcrypt-devel-2.5.8-9.puias6.x86_64.rpm
rpm -ivh libmcrypt-2.5.8-9.puias6.x86_64.rpm
rpm -ivh libmcrypt-devel-2.5.8-9.puias6.x86_64.rpm

2. MySQL 라이브러리 참조

cd /usr/local/mysql
ln -s lib lib64


3. PHP 다운로드 및 컴파일

cd /usr/local/src
wget http://kr1.php.net/get/php-5.6.25.tar.gz/from/this/mirror
tar xvfz mirror
cd php-5.6.25
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/apache/conf \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--with-regex=php \
--with-libxml-dir=/usr \
--with-openssl --with-pcre-regex --with-zlib \
--with-bz2 --with-curl --with-gdbm \
--with-db4=/usr --with-dbm --with-pcre-dir=/usr --with-openssl-dir=/usr \
--with-libxml-dir=/usr --with-gd --with-vpx-dir=/usr --with-jpeg-dir=/usr \
--with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr \
--with-t1lib=/usr --with-gettext --with-gmp --with-mhash --with-imap \
--with-imap-ssl --with-kerberos --with-icu-dir=/usr --with-ldap \
--with-ldap-sasl --with-libmbfl --with-onig --with-mcrypt \
--with-libedit --with-readline --with-tidy --with-libexpat-dir=/usr \
--with-xmlrpc --with-xsl --with-pear --with-pic --with-libdir=lib64 \
--enable-bcmath --enable-calendar --enable-exif \
--enable-ftp --enable-pcntl --enable-gd-native-ttf \
--enable-gd-jis-conv --enable-intl --enable-mbstring \
--enable-shmop --enable-sockets --enable-sysvmsg \
--enable-sysvsem --enable-sysvshm --enable-wddx \
--enable-zip --enable-mysqlnd --enable-dba=shared \
--enable-mod-charset --enable-dom --enable-mbregex \
--enable-inline-optimization --enable-sigchild --enable-soap \
--enable-maintainer-zts --enable-opcache=nom

make
make install


4. PHP 환경설정

cp php.ini-production /etc/httpd/php.ini
 vi /etc/httpd/php.ini

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Module Settings;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[Date]
date.timezone = "Asia/Seoul"



5. Apache 환경설정

vi /usr/local/apache/conf/httpd.conf

# httpd.conf 내에서 PHP모듈이 정상적으로 추가되어있는지 확인 (자동으로 연동되어 등록됨)
LoadModule php5_module          modules/libphp5.so

#<IfModule dir_module>을 찾아 아래 내용 추가
<IfModule dir_module>
     DirectoryIndex index.html index.htm index.php index.cgi
</IfModule>

#<IfModule mime_module> 을 찾아 아래 내용 추가
<IfModule mime_module>
     AddType application/x-compress . z
     AddType application/x-gzip . gz . tgz
     AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml .html .htm .inc
     AddType application/x-httpd-source .phps
</IfModule>

#httpd.conf 저장한 뒤
/etc/init.d/httpd restart



6. 환경변수 등록

cd ~
vi .bash_profile

#PATH부분에 아래 내용을 추가한다
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/php/bin

#.bash_profile 저장한 뒤

source .bash_profile




7. 연동 확인

vi /usr/local/apache/htdocs/phpinfo.php

<? php
phpinfo();
?>

# 입력 후 저장



이렇게 APM 설치를 마무리했다.
각 버전마다 컴파일 설정값이나 관련 라이브러리가 바뀌는 등 여러가지 변수가 있을 수 있으니, 실제 진행할 때 이 점을 유의해야한다.


이번 포스팅을 진행할 때, 사용한 버전은 최대한 이것저것 테스트 해보긴 했지만 부족한 부분이나 잘못된 부분이 있다면 언제든 댓글 부탁드립니다.


* APM 소스설치 링크

[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 1 http://jguru-study.tistory.com/29
[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 2 http://jguru-study.tistory.com/30
[Linux] CentOS에 APM Source 설치 (Apache,PHP,MySQL) - 3 http://jguru-study.tistory.com/31