본문 바로가기

리눅스

[리눅스] PHP-FPM 최신(php-fpm 8.1) 버전 설치하기

728x90

PHP-FPM 최신(php-fpm 8.1) 버전 설치하기

 php-fpm : PHP FastCGI Process Manager

테스트 환경

$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

$ getconf LONG_BIT
64

EPEL 및 YUM Utilities 패키지 설치

yum -y install epel-release yum-utils

$ yum -y install epel-release yum-utils

Remi 저장소 설치

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

$ yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

remi 저장소 활성화

 PHP 5.4 비활성화(default version) 및 PHP 7.4 활성화

default version 정보

yum info php-fpm | grep Version

$ yum info php-fpm | grep Version
Version     : 5.4.45

php 5.4 비활성화(default version)

yum-config-manager --disable remi-php54

$ yum-config-manager --disable remi-php54

php 8.1 활성화

yum-config-manager --enable remi-php81

$ yum-config-manager --enable remi-php81

PHP 8 설치

php(php-fpm) 8.1 설치

yum install -y php php-cli php-common php-devel php-pear php-fpm

$ yum install -y php php-cli php-common php-devel php-pear php-fpm

php 추가 모듈 설치

yum install -y php-mysqlnd php-mysql php-mysqli php-zip php-gd php-curl php-xml php-json php-intl php-mbstring php-mcrypt php-posix php-shmop php-soap php-sysvmsg php-sysvsem php-sysvshm php-xmlrpc php-opcache

$ yum install -y php-mysqlnd php-mysql php-mysqli php-zip php-gd php-curl php-xml php-json php-intl php-mbstring php-mcrypt php-posix php-shmop php-soap php-sysvmsg php-sysvsem php-sysvshm php-xmlrpc php-opcache

php-fpm 버전 정보

php-fpm -version

$ php-fpm -version
PHP 8.1.3 (fpm-fcgi) (built: Feb 16 2022 01:00:24)
Copyright (c) The PHP Group
Zend Engine v4.1.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.3, Copyright (c), by Zend Technologies

php-fpm 서비스를 시작하고 부팅 시 자동으로 시작하도록 활성화

systemctl --now enable php-fpm

$ systemctl --now enable php-fpm

PHP 버전 정보 숨기기

php.ini 파일 경로 찾기

php --ini | egrep "Loaded Configuration File"

$ php --ini | egrep "Loaded Configuration File"
Loaded Configuration File:         /etc/php.ini

PHP 버전 숨기기

sed -i "s/expose_php = On/expose_php = Off/g" /etc/php.ini

$ sed -i "s/expose_php = On/expose_php = Off/g" /etc/php.ini
728x90