본문 바로가기

리눅스

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

반응형

우분투에서 PHP-FPM 최신(php-fpm 8.1) 버전 설치하기

 php-fpm : PHP FastCGI Process Manager

테스트 환경

$ lsb_release -d
Description:    Ubuntu 22.04.2 LTS

$ uname -m
x86_64

$ getconf LONG_BIT
64

PPA(Personal Package Archive) 리포지토리를 시스템의 패키지 소스 목록에 추가

sudo add-apt-repository ppa:ondrej/php
apt-get update -y

PHP 8 설치

php(php-fpm) 8.1 설치

sudo apt-get install -y php8.1 php8.1-dev php8.1-cli php8.1-fpm php8.1-common php8.1-igbinary

php 추가 모듈 설치

sudo apt-get install -y  php8.1-gd php8.1-mysql php8.1-curl php8.1-mbstring \
php8.1-mcrypt php8.1-intl php8.1-xml php8.1-redis php8.1-readline php8.1-mongodb \
php8.1-zip php8.1-imagick php8.1-rdkafka php-json php-pear
728x90

php-fpm 버전 정보

php-fpm8.1 --version
$ php-fpm8.1 --version
PHP 8.1.18 (fpm-fcgi) (built: Apr 14 2023 04:39:44)
Copyright (c) The PHP Group
Zend Engine v4.1.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.18, Copyright (c), by Zend Technologies

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

systemctl --now enable php8.1-fpm

PHP 버전 정보 숨기기

php.ini 파일 경로 찾기

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

PHP 버전 숨기기

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

php-fpm.conf 문법 검사

php-fpm8.1 -t
$ php-fpm8.1 -t
[20-Apr-2023 13:06:40] NOTICE: configuration file /etc/php/8.1/fpm/php-fpm.conf test is successful

php 모듈 목록 확인

php-fpm8.1 -m
$ php-fpm8.1 -m
[PHP Modules]
bcmath
calendar
cgi-fcgi
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imagick
intl
json
libxml
mbstring
mcrypt
mongodb
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
posix
rdkafka
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

 

728x90
반응형