Linux WEB

Apache / PHP 최신버전 설치하기

2015.09.25 16:41

호스트웨이 조회 수:16487

# Apache / PHP 최신버전 설치 내용 입니다.
간략한 conf 파일 수정이 있으니 사용자의 내용에 맞게 수정하시면 될 것 같습니다.

1. Version 정보

            구분            

                      Version                      

Apr

1.5.2 

Apr-Util 

1.5.4 

Apache 

2.4.16 

PHP 

5.6.13


 - 설치에 앞서 설치를 진행하는 기본디렉토리

         >   /usr/local/src

- 위의 디렉토리에 작업한 기준 입니다. 디렉토리를 꼭 확인하세요.


2. Apache 설치하기
 - Apr 설치
 - 다운로드
         >   wget http://apache.mirror.cdnetworks.com/apr/apr-1.5.2.tar.gz
 - 압축해제
         >   tar xvfz apr-1.5.2.tar.gz
 - 압축해제 디렉토리 접근
         >   cd apr-1.5.2
 - configure 및 make
./configure


make && make install 

 
 - Apr-util 설치
 - 다운로드
         >   wget http://apache.mirror.cdnetworks.com/apr/apr-1.5.4.tar.gz
 - 압축해제
         >   tar xvfz apr-util-1.5.4.tar.gz
 - 압축해제 디렉토리 접근
         >   cd apr-util-1.5.4
 - configure 및 make
./configure --with-apr=/usr/local/apr


make && make install 

 
 - Apache 설치
 - 다운로드
         >   wget http://mirror.apache-kr.org/httpd/httpd-2.4.16.tar.gz
 - 압축해제
         >   tar xvfz httpd-2.4.16.tar.gz
 - 압축해제 디렉토리 접근
         >   cd httpd-2.4.16
 - pcre 설치
         >   yum install pcre-devel -y
 - configure 및 make
./configure --prefix=/usr/local/apache2 \
--with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config \
--enable-module=so \
--enable-mods-shared=all

make && make install 



 - Apache 설치 확인
/usr/local/apache2/bin/apachectl -V
Server version: Apache/2.4.16 (Unix)
Server built:   Sep 25 2015 15:32:40
Server's Module Magic Number: 20120211:47
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr/local/apache2"
 -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"

 -D SERVER_CONFIG_FILE="conf/httpd.conf" 


3. PHP 설치

 - 다운로드

         >   wget -O php-5.6.13.tar.gz wget http://kr1.php.net/get/php-5.6.13.tar.gz/from/this/mirror

 - 압축해제

         >   tar xvfz php-5.6.13.tar.gz

 - 압축해제 디렉토리 접근

         >   cd php-5.6.13

 - configure 및 make

./configure --prefix=/usr/local/php \

   --with-apxs2=/usr/local/apache2/bin/apxs \

   --with-config-file-path=/usr/local/apache2/conf \

   --with-gd \

   --with-zlib \

   --with-iconv \

   --with-png-dir \

   --with-jpeg-dir \

   --with-freetype-dir \

   --with-libxml-dir \

   --with-mcrypt \

   --with-openssl \

   --with-curl \

   --with-imap-ssl \

   --with-kerberos \

   --enable-mbstring \

   --enable-calendar \

   --enable-sockets \

   --enable-ftp \

   --disable-debug \

   --disable-maintainer-zts 


make && make install


 - php.ini 복사

         >   cp php.ini-production /usr/local/apache2/conf/php.ini

 - php 버전 확인

         >   /usr/local/php/bin/php -v


4. conf 파일 수정

 - httpd.conf 수정

 - vi /usr/local/apache2/conf/httpd.conf (수정전에 httpd.conf 기본파일은 꼭 백업해주세요. ex : httpd.conf_ori)


변경전

변경후

#ServerName www.example.com:80

ServerName 127.0.0.1

<Directory />

    AllowOverride none

    Require all denied

</Directory> 

<Directory />

    AllowOverride none

    Require all granted

</Directory>

 <IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

 <IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php .inc .lib .html .htm

AddType application/x-httpd-php-source .phps

#Include conf/extra/httpd-vhosts.conf

Include conf/extra/httpd-vhosts.conf

#LoadModule rewrite_module modules/mod_rewrite.so

LoadModule rewrite_module modules/mod_rewrite.so

User daemon

Group daemon

User 유저계정

Group 유저그룹


- php.ini 수정

- vi /usr/local/apache2/conf/php.ini (수정전 php.ini 파일은 꼭 백업해두세요 ex : php.ini_ori)

변경전

변경후

short_open_tag = Off

short_open_tag = On

;date.timezone =

date.timezone = Asia/Seoul

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

error_reporting = E_ALL & ~E_NOTIC

;error_log = php_errors.log

error_log = /usr/local/apache2/logs/php_errors.log


위와 같이 수정하시면 되겠습니다.

번호 제목 글쓴이 날짜 조회 수
63 아파치 특정폴더에 암호걸기 호스트웨이 2012.12.28 8163
62 PHP 컴파일시 에러 메세지가 나오는 경우 조치방법-2 호스트웨이 2012.12.20 6123
61 PHP 컴파일시 에러 메세지가 나오는 경우 조치방법 호스트웨이 2012.12.14 10310
60 Ubuntu 아파치 웹서버에서 index.php 다운로드 창이 뜰 경우 호스트웨이 2012.12.13 8181
59 Symbolic link not allowed or link target not accessible 에러 발생 시 호스트웨이 2012.11.16 10541
58 CentOS6 64bit openssl 설치시 에러 조치사항 호스트웨이 2012.11.02 7605
57 [php] 세션 유지시간 설정하기 호스트웨이 2012.10.25 17769
56 Apache 재시작시 세션 끊어짐 현상 호스트웨이 2012.10.12 12738
55 apache 구동시 "파일 크기 제한을 초과함 $HTTPD -DSSL" 에러메시지 출력에 대한 해결방법 호스트웨이 2012.10.11 9400
54 failed to open stream: Too many open files in 에러메시지 출력 시 해결방법 호스트웨이 2012.10.03 7621
53 httpd-2.4 설치하기 호스트웨이 2012.09.27 14436
52 아파치 실행시 libphp5.so 에러 호스트웨이 2012.09.14 13523
51 apache internal dummy connection 로그 생성 방지하기 호스트웨이 2012.09.06 18689
50 SSL 패스워드 삭제 하기 호스트웨이 2012.09.05 20690
49 Apache Max Client 값 수정 호스트웨이 2012.08.31 19627
48 Nginx 설치 호스트웨이 2012.08.31 14896
47 nginx - redirect 설정 호스트웨이 2012.08.24 17883
46 CentOS 6.3 에 apache, php, mysql, phpmyadmin(LAMP) 설치하기 #2 호스트웨이 2012.08.07 14202
45 CentOS 6.3 에 apache, php, mysql, phpmyAdmin(LAMP) 설치하기 #1 호스트웨이 2012.08.07 17343
44 PHP 사용 시 특정함수 사용제한 하는 방법 호스트웨이 2012.08.03 11502