• 맑음동두천 8.1℃
  • 맑음강릉 8.5℃
  • 구름조금서울 8.3℃
  • 구름많음대전 11.6℃
  • 구름많음대구 14.4℃
  • 구름많음울산 8.8℃
  • 흐림광주 11.1℃
  • 구름많음부산 9.7℃
  • 구름많음고창 6.3℃
  • 흐림제주 12.7℃
  • 구름조금강화 5.0℃
  • 구름많음보은 9.9℃
  • 구름많음금산 11.1℃
  • 흐림강진군 11.2℃
  • 구름조금경주시 8.2℃
  • 구름조금거제 9.9℃
기상청 제공

Apache2 와 php 5 연동 설치

  • 등록 -0001.11.30 00:00:00
아파치(apache)2 와 php 5 연동 설치 (Fedora Core 2에서 설치)
※ RPM으로 설치하는 방법은 없는 듯...
 
● 아파치 2 설치
 1. httpd-2.0.52.tar.gz 파일 압축을 풀고, 폴더 이동
 2. 컴파일 환경설정
    $ ./configure
       --prefix=/usr/local/apache
       --enable-rule=SHARED_CORE
       --enable-module=so
       --enable-so
       --enable-mods-shared=all
       --with-mpm=threadpool
       --enable-file-cache
       --sysconfdir=/usr/local/apache/conf
       --datadir=/usr/local/apache
 3. 컴파일/설치
     $ make ; make install
 4. 아파치 환경설정파일(/usr/local/apache/conf/httpd.conf) 수정
   - DirectoryIndex 항목 수정
      DirectoryIndex index.php index.php3 index.html index.htm index.html.var
   - AddType 부분을 찾아서 다음을 추가
      AddType application/x-httpd-php .php .php3 .inc .ph .htm
      AddType application/x-httpd-php-source .phps
 5. 환경설정파일 문법 확인
    $ /usr/local/apache/bin/httpd -t
 6. 아파치 시작
   $ /usr/local/apache/bin/apachectl start
 
● php 5 설치
 1. php-5.0.5.tar.bz2 파일 압축을 풀고, 폴더 이동
 2. 컴파일 환경설정
    $ ./configure
      --with-exec-dir=/usr/bin
      --with-apxs2=/usr/local/apache/bin/apxs
      --with-apache-install=/usr/local/apache
      --with-config-file-path=/etc
      --disable-debug
      --enable-safe-mode
      --enable-track-vars
      --enable-sockets
      --with-png-dir=/usr/lib
      --with-freetype-dir=/usr/include/freetype2
      --with-mod_charset
      --with-charset=euc_kr
      --with-xml
      --with-language=korean
      --enable-mailparse
      --enable-calender
      --enable-sysvsem=yes
      --enable-sysvshm=yes
      --enable-ftp
      --enable-magic-quotes
      --enable-gd-native-ttf
      --enable-versioning
      --enable-url-includes
      --enable-trans-id
      --enable-inline-optimization
      --enable-bcmath
      --with-pspell
      --with-jpeg
      --with-png
      --with-zlib
      --with-jpeg-dir=/usr/src
      --with-gd
      --with-ttf
      --with-gettext
      --enable-sigchild
      --enable-module=so
 3. 컴파일/설치
     $ make ; make install
 4. php 환경설정
     - 디폴트 php 환경설정 파일 복사
       $ cp 소스폴더/php.ini-dist /etc/php.ini
     - php 환경설정 파일 수정
         register_globals = ON
         default_mimetype = "text/html"
         default_charset = "euc_kr"
 
● 아파치에서 php 모듈 인식 확인
 1. 아파치 환경설정파일(/usr/local/apache/conf/httpd.conf)에
     LoadModule php5_module        modules/libphp5.so
     -> 있으면 이상무
 
● php 최적화 (ZendOptimizer 설치)
 1. ZendOptimizer-2.5.10a-linux-glibc21-i386.tar.gz 파일 압축을 풀고, 폴더 이동
 2. ZendOptimizer 설치
   - $ ./install.sh
 
● 아파치와 php 연동 확인
 1. /usr/local/apache/htdocs 폴더에 다음 내용의 test.php 파일 생성
    <? phpinfo(); ?>
  2. 브라우저를 이용하여 http://localhost/test.php 가 정상적으로 뜨면 완료
 
● 시스템 구동 시 아파치 자동실행 설정
 1. 서비스 시작 (시스템 부팅시)
   $ cp -p /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
   $ ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S80httpd
   $ ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S80httpd
 2. 서비스 종료 (시스템 종료 시)
   $ ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K30httpd
   $ ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc1.d/K30httpd
   $ ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc6.d/K30httpd