
CentOS/RHEL 7에 PHP 7.4, 7.3 및 7.2를 설치하는 방법
PHP 7.4는 PHP의 안정적인 최신 릴리스입니다. 인기 있는 yum 저장소의 5월은 PHP 7용 rpm 패키지를 제공합니다. 이 기사에서는 시스템에 필요한 패키지를 설치하기 위해 Remi 및 EPEL yum 저장소를 사용합니다. 이 기사는 CentOS 및 Redhat 7 서버에 PHP 7.4, PHP 7.3, PHP 7.2, PHP 7.1을 설치하는 데 도움이 될 것입니다. 이 튜토리얼은 CentOS Linux 릴리스 7.4.1708에서 테스트되었습니다. Install PHP7, Nginx and MySQL on CentOS/RedHat
Yum 저장소 설정
우선 시스템에서 Remi 및 EPEL yum 저장소를 활성화해야 합니다. 다음 명령을 사용하여 CentOS 및 Red Hat 7/6 시스템에 EPEL 리포지토리를 설치합니다.이 명령을 사용하여 시스템에 EPEL yum 리포지토리를 설치하고이제 운영 체제 버전에 따라 다음 명령 중 하나를 실행하여 Remi 리포지토리를 설치합니다. .sudo yum install epel-release
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
CentOS에 PHP 7 설치
시스템이 yum 저장소에서 PHP를 설치할 준비가 되었습니다. 다음 명령 중 하나를 사용하여 요구 사항에 따라 시스템에 PHP 7.4 또는 PHP 7.3 또는 PHP 7.2 또는 PHP 7.1을 설치합니다.시스템에 최신 버전의 PHP 7.4를 설치했습니다. 이제 다음 명령을 실행하여 내 시스템의 현재 활성 PHP 버전을 확인합니다.## Install PHP 7.4 yum --enablerepo=remi-php74 install php ## Install PHP 7.3 yum --enablerepo=remi-php73 install php ## Install PHP 7.2 yum --enablerepo=remi-php72 install php ## Install PHP 7.1 yum --enablerepo=remi-php71 install php
php -v PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
PHP 모듈 설치
응용 프로그램 요구 사항에 따라 추가 PHP 모듈을 설치해야 할 수도 있습니다. 아래 명령은 좀 더 유용한 PHP 모듈을 설치합니다.다음 명령을 실행하여 구성된 yum 저장소에서 사용 가능한 다른 PHP 모듈을 검색할 수 있습니다. 아래 예제 명령은 PHP 7.4의 모든 모듈을 검색합니다.### For PHP 7.4 yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.3 yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.2 yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.1 yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
yum --enablerepo=remi-php73 search php | grep php73 * remi-php74: repo1.ash.innoscale.net php74.x86_64 : Package that installs PHP 7.4 php74-php.x86_64 : PHP scripting language for creating dynamic web sites php74-php-bcmath.x86_64 : A module for PHP applications for using the bcmath php74-php-brotli.x86_64 : Brotli Extension for PHP php74-php-cli.x86_64 : Command-line interface for PHP php74-php-common.x86_64 : Common files for PHP php74-php-componere.x86_64 : Composing PHP classes at runtime php74-php-dba.x86_64 : A database abstraction layer module for PHP applications php74-php-dbg.x86_64 : The interactive PHP debugger php74-php-devel.x86_64 : Files needed for building PHP extensions php74-php-embedded.x86_64 : PHP library for embedding in applications php74-php-enchant.x86_64 : Enchant spelling extension for PHP applications php74-php-fpm.x86_64 : PHP FastCGI Process Manager php74-php-gd.x86_64 : A module for PHP applications for using the gd graphics php74-php-gmp.x86_64 : A module for PHP applications for using the GNU MP php74-php-imap.x86_64 : A module for PHP applications that use IMAP php74-php-intl.x86_64 : Internationalization extension for PHP applications php74-php-json.x86_64 : JavaScript Object Notation extension for PHP ... ...