gbmin's Tech Notes

서버 구축 및 유지보수, 클라우드 컴퓨팅, 네트워크 보안, IT 분야 기술 노트. :)

Tech Notes/Linux

centos7 - PHP 버전별 설치 방법 (PHP5.x, PHP7.x, PHP8.x)

gbmin 2023. 4. 29. 15:33

centos 7 기본 저장소의 php 버전은 5.4 버전으로 설치된다. 상위 버전의 php 설치를 위한 매뉴얼을 정리한다.
rpm 패키지 설치를 통해서 처리하였다.

 

1. 설치 매뉴얼

Remi Collet은 프랑스 출신의 오픈소스 개발자로 PHP와 관련된 다양한 프로젝트를 주도하고 있다.
그중 하나가 Remi 저장소다. Remi 저장소는 최신 버전의 PHP를 CentOS와 RHEL과 같은 Red Hat 계열의
Linux 배포판에서 사용할 수 있도록 제공한다. 이 저장소는 안정적이고 업데이트가 자주 이루어진다.
Remi 저장소의 PHP 패키지를 이용하여 설치 매뉴얼을 작성하였다.

 

  • 저장소 설치
[root@gbminnote ~]# yum install epel-release yum-utils
[root@gbminnote ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  • 설치 가능한 PHP 버전을 체크
[root@gbminnote ~]# yum list | awk '/php[0-9]+/ {print substr($1, 1, 5)}' | sort -u
php54
php55
php56
php70
php71
php72
php73
php74
php80
php81
php82
  • 설치할 PHP 버전 선택
[root@gbminnote ~]# yum-config-manager --enable remi-php74
  • PHP 설치 및 모듈 설치
[root@gbminnote ~]# yum install php 
[root@gbminnote ~]# yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

 

2. PHP 버전별 설치 매뉴얼

php 5.5 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php55
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 5.6 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php56
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 7.0 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php70
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 7.1 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php71
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 7.2 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php72
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 7.3 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php73
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 7.4 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php74
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 8.0 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php80
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 8.1 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php81
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl

 

php 8.2 설치

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php82
yum install php 
yum install php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo php-curl