본문으로 바로가기

centOS 7 웹서버 APM 설치 - apache, php, mariaDB : yum 설치 



1.의존성 라이버러리 설치

 # yum -y install gcc gcc-c++  libtermcap-devel gdbm-devel zlib* libxml* freetype* libjpeg* gd-* 
 # yum -y install libpng* --skip-broken

2.Apache 설치
 # yum -y install httpd

 [.apache 명령어]
 . 실행 상태보기
   #  systemctl status httpd

 .서비스 시작
    # systemctl start httpd 

 .부팅시 자동 실행 설정
   # systemctl enable httpd.service 


3.PHP 설치
 1).설치
 # yum -y install php php-mysql php-pdo php-gd php-mbstring
 
 2)php 테스트 페이지 작성
 # echo "" > /var/www/html/ptest.php

 3).세션 사용
  # chmod 777 /var/lib/php/session/ 

4.기타사할
 1).아파치 서버 재시작
   # systemctl restart httpd

 위 화면에 대한 설명

    1.웹서버 재시작

      # systemctl restart httpd

 

    2.아파치 웹서버 버젼 확인

     # httpd -v

        Server version: Apache/2.4.6 (CentOS)
        Server built:   Apr 12 2017 20:58:52
  

   3.php 버젼 확인  
      # php -v
        PHP 5.4.16 (cli) (built: Nov  6 2016 00:15:04)
        Copyright (c) 1997-2013 The PHP Group
        Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies


   4.서버 실행 상태 확인

     # ps -ef | grep httpd

        apache    4750  4748  0 08:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache    4751  4748  0 08:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache    4752  4748  0 08:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache    4753  4748  0 08:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache    4754  4748  0 08:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND


 2).아파치 설정파일 구문 및 동작검사
    # service httpd configtest
     
 3).서비스가 운영중일 때는 restart 대신 reload 를 사용.
    # service httpd reload
    
 4).웹서버 실행 확인하기
    # systemctl list-unit-files | grep httpd       
     httpd.service                                 enabled
     
 5). 리눅스 보안강화 모듈 해제하기    
    # setenforce 0
    # vi /etc/sysconfig/selinux
       # SELINUX=enforcing   // 이 부분을 
          SELINUX=disabled   // desabled 로 수정합니다.


 7).웝서버 설정파일 수정
    # vi /etc/httpd/conf/httpd.conf  파일에서

 

       #ServerName www.example.com:80  //로 된 부분을 찾아 
          ServerName 127.0.0.1:80           //이처럼  주석을 제거하고 수정합니다.



[php와 아파치 연동 확인]


아파치 웹서버와 php가 잘 연동 되는지 확인해 봅니다.