GNU/Linux >> Linux の 問題 >  >> Cent OS

CentOS / RHEL6.10にPHP7.3、7.2、7.1をインストールする方法

PHP 7.3は、PHPの最新の安定したリリースです。人気のあるyumリポジトリの5月は、PHP 7用のrpmパッケージを提供しています。この記事では、システムに必要なパッケージをインストールするためにRemiおよびEPELyumリポジトリを使用しています。この記事は、CentOSおよびRHEL6システムにPHP7.3、PHP 7.2、PHP7.1をインストールするのに役立ちます。

  • CentOS / RedHatにPHP7、Nginx、MySQLをインストールする

Yumリポジトリーの構成

まず、システムでRemiおよびEPELyumリポジトリを有効にする必要があります。次のコマンドを使用して、CentOSおよびRedHat7/6システムにEPELリポジトリをインストールします

このコマンドを使用して、epel-releaseyumリポジトリをインストールします

yum install epel-release

次に、オペレーティングシステムのバージョンに従って次のコマンドのいずれかを実行して、Remiリポジトリをインストールします。

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

CentOS6にPHP7をインストールする

システムは、yumリポジトリからのPHPインストールの準備ができています。次のいずれかのコマンドを使用して、要件に基づいてPHP 7.3、PHP 7.2、またはPHP7.1をシステムにインストールします。

## 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

システムに最新バージョンのPHP7.3をインストールしました。次のコマンドを実行して、システムで現在アクティブなPHPのバージョンを確認します。

php -v

PHP 7.3.11 (cli) (built: Oct 22 2019 12:34:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

PHPモジュールのインストール

また、アプリケーションの要件に基づいて、追加のPHPモジュールをインストールする必要がある場合もあります。以下のコマンドは、いくつかのより便利なPHPモジュールをインストールします。

### 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リポジトリーで使用可能な他のPHPモジュールを検索できます。以下のコマンド例では、PHP7.3のすべてのモジュールを検索します。

yum --enablerepo=remi-php73 search php | grep php73

php73.x86_64 : Package that installs PHP 7.3
php73-php.x86_64 : PHP scripting language for creating dynamic web sites
php73-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php73-php-brotli.x86_64 : Brotli Extension for PHP
php73-php-cli.x86_64 : Command-line interface for PHP
php73-php-common.x86_64 : Common files for PHP
...
...

Cent OS
  1. CentOS 7 /RHEL7およびCentOS6/RHEL6にPHP7.4/ 7.3/7.2をインストールする方法

  2. CentOS 8 /RHEL8にPHP7.4/7.3をインストールする方法

  3. CentOS7にPHP7.2をインストールする方法

  1. CentOSにPHP5.5をインストールする方法

  2. CentOS7にPHP5.6をインストールする方法

  3. CentOS7にPHP8をインストールする方法

  1. CentOS8にPHP7.3をインストールする方法

  2. CentOS8にPHP8をインストールする方法

  3. CentOS7にPHP7.3をインストールする方法