GNU/Linux >> Linux の 問題 >  >> Debian

PHP5.6および7.0-8.1をPHPとしてインストールする方法-Debian8〜11でaptを使用したISPConfig3用のFPMおよびFastCGI

このチュートリアルでは、ISPConfigDebianサーバーに複数のPHPバージョンをインストールする方法を示します。 PHPバージョンは、後で各サイトのISPConfig3Webサイト設定で個別に選択できます。この機能は、PHP-FPMおよびFastCGIで機能します。 sury.orgのPHPパッケージを使用して、PHP 5.6、7.x、8.xをPHP-FPMおよびFastCGIバージョンとしてDebianサーバーにインストールします。

1予備メモ

apt-getを使用してDebianPHPパッケージメンテナサイトhttps://packages.sury.org/php/から直接PHPをインストールします。これにより、既存のインストールが上書きされることはありませんが、デフォルトで使用されているPHPバージョンが最新のインストール済みバージョンに変更されます。したがって、インストールされたバージョンの新しいPHPバージョンをISPConfigに追加し、最初にすべてのサイトをこのバージョンに変更することが非常に重要です。 PHPスクリプトを呼び出すcronジョブを使用している場合は、それらも適応させる必要があります。後で詳しく説明します。

opensslとしての他のパッケージも更新されるため、sury.orgからインストールされたパッケージは、インストール後に単純に削除することはできません。他のパッケージを壊さずにPHPパッケージを削除する前に、まずこのパッケージをDebianバージョンにダウングレードする必要があります。私にとって最も簡単な方法は、新しく追加されたリポジトリを非アクティブ化することでした。そうすれば、sury.orgからインストールされたパッケージは、aptitudeで自己作成または非推奨のパッケージとして表示され、パッケージごとにダウングレードできます。

PHP-FPMはApacheサーバーとNginxサーバーの両方で使用できますが、FastCGIはApacheサーバーでのみ使用できることに注意してください。

2ISPConfigでPHPバージョンを有効にする

ISPConfig 3では、[システム]>[追加のPHPバージョン]で新しいPHPバージョンを構成できます。

DebianのPHPバージョンを追加

DebianバージョンのPHPがインストールされていない場合は、この手順をスキップできます。

まず最初に、すでにインストールされているPHPバージョンの新しいバージョンを追加する必要があります。 [名前]タブで、PHPバージョン(Debian 5.6など)の名前を入力するだけです。このPHPバージョンは、ISPConfigのWebサイト設定でこの名前の下に一覧表示されます:

FastCGI設定タブに移動し、次のようにフィールドに入力します。

Path to the PHP FastCGI binary: php5-cgi
Path to the php.ini directory: /etc/php5/cgi/php.ini

次に、[PHP-FPM設定]タブに移動し、次のようにフィールドに入力します。

Path to the PHP-FPM init script: php5-fpm
Path to the php.ini directory: /etc/php5/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php5/fpm/pool.d

cronジョブの重要な手順

PHPスクリプトを呼び出すcronジョブを使用する場合は、使用するバージョンもcronに指示する必要があります。コマンドの先頭にphp5を追加して、Debianのバージョンを使用します。正確に何を使用しているかわからない場合は、シンボリックリンク/ usr / bin / phpをたどり、その最終的な宛先をプレフィックスとして使用してください。

他のPHPバージョンを追加する

現在、https://packages.sury.org/php/で利用可能な3つのバージョンがあり、インストールするすべてのバージョンに対して、ここで最後の手順を繰り返す必要があります。ただし、代わりに次の設定を使用してください。

PHP 5.6

Path to the PHP FastCGI binary: php-cgi5.6
Path to the php.ini directory: /etc/php/5.6/cgi/php.ini
Path to the PHP-FPM init script: php5.6-fpm
Path to the php.ini directory: /etc/php/5.6/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/5.6/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp5.6です。

PHP 7.0

Path to the PHP FastCGI binary: php-cgi7.0
Path to the php.ini directory: /etc/php/7.0/cgi/php.ini
Path to the PHP-FPM init script: php7.0-fpm
Path to the php.ini directory: /etc/php/7.0/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.0/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp7.0です。

PHP 7.1

Path to the PHP FastCGI binary: php-cgi7.1
Path to the php.ini directory: /etc/php/7.1/cgi/php.ini
Path to the PHP-FPM init script: php7.1-fpm
Path to the php.ini directory: /etc/php/7.1/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.1/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp7.1です。

PHP 7.2

Path to the PHP FastCGI binary: php-cgi7.2
Path to the php.ini directory: /etc/php/7.2/cgi/php.ini
Path to the PHP-FPM init script: php7.2-fpm
Path to the php.ini directory: /etc/php/7.2/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.2/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp7.2です。

PHP 7.3

Path to the PHP FastCGI binary: php-cgi7.3
Path to the php.ini directory: /etc/php/7.3/cgi/php.ini
Path to the PHP-FPM init script: php7.3-fpm
Path to the php.ini directory: /etc/php/7.3/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.3/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp7.3です。

PHP 7.4

Path to the PHP FastCGI binary: php-cgi7.4
Path to the php.ini directory: /etc/php/7.4/cgi/php.ini
Path to the PHP-FPM init script: php7.4-fpm
Path to the php.ini directory: /etc/php/7.4/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.4/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp7.4です。

PHP 8.0

Path to the PHP FastCGI binary: php-cgi8.0
Path to the php.ini directory: /etc/php/8.0/cgi/
Path to the PHP-FPM init script: php8.0-fpm
Path to the php.ini directory: /etc/php/8.0/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.0/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp8.0

PHP 8.1

Path to the PHP FastCGI binary: php-cgi8.1
Path to the php.ini directory: /etc/php/8.1/cgi/
Path to the PHP-FPM init script: php8.1-fpm
Path to the php.ini directory: /etc/php/8.1/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.1/fpm/pool.d

たとえば、CLIバージョンcronジョブの名前はphp8.1

3ウェブサイトのPHPバージョンを変更する

DebianバージョンのPHPがインストールされていない場合は、この手順をスキップできます。

次に、すべてのWebサイトのPHPバージョンを新しく作成したバージョン(Debian 5.6など)に変更します。

また、上記のようにcronジョブを変更することを忘れないでください。

4packages.sury.orgにリポジトリを追加します

packages.sury.orgにリポジトリを追加し、そのBGPキーを適切に追加するには、次のコマンドを使用します。

apt-get install -y apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

次のコマンドは1行だけで、改行を追加しないでください:

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update

すでにインストールされているパッケージを新しいリポジトリからアップグレードするには、次のコマンドを使用します。

apt-get upgrade

5packages.sury.orgからPHPをインストールします

ここでは、インストールするための複数のオプションを提供しています。目的のバージョンを選択し、残りをスキップしてください!

5.1PHP5.6のインストール

PHPをインストールするには、次のコマンドを使用します:

apt-get install php5.6 php5.6-cli php5.6-cgi php5.6-fpm php5.6-gd php5.6-mysql php5.6-imap php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php5.6-soap php5.6-opcache libicu65 php5.6-common php5.6-json php5.6-readline php5.6-xml

5.2PHP7.0のインストール

PHPをインストールするには、次のコマンドを使用します:

apt-get install php7.0 php7.0-cli php7.0-cgi php7.0-fpm php7.0-gd php7.0-mysql php7.0-imap php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-zip php7.0-mbstring php7.0-soap php7.0-opcache php7.0-common php7.0-json php7.0-readline php7.0-xml

5.3PHP7.1のインストール

PHPをインストールするには、次のコマンドを使用します:

apt-get install php7.1 php7.1-cli php7.1-cgi php7.1-fpm php7.1-gd php7.1-mysql php7.1-imap php7.1-curl php7.1-intl php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl php7.1-zip php7.1-mbstring php7.1-soap php7.1-opcache php7.1-common php7.1-json php7.1-readline php7.1-xml

5.4PHP7.2のインストール

PHPをインストールするには、次のコマンドを使用します:

apt-get install php7.2 php7.2-cli php7.2-cgi php7.2-fpm php7.2-gd php7.2-mysql php7.2-imap php7.2-curl php7.2-intl php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-zip php7.2-mbstring php7.2-soap php7.2-opcache php7.2-common php7.2-json php7.2-readline php7.2-xml

5.5PHP7.3をインストールする

PHPをインストールするには、次のコマンドを使用します:

apt-get install php7.3 php7.3-cli php7.3-cgi php7.3-fpm php7.3-gd php7.3-mysql php7.3-imap php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-zip php7.3-mbstring php7.3-soap php7.3-opcache php7.3-common php7.3-json php7.3-readline php7.3-xml

5.6PHP7.4をインストール

PHP 7.4をインストールするには、次のコマンドを使用します。

apt-get install php7.4 php7.4-cli php7.4-cgi php7.4-fpm php7.4-gd php7.4-mysql php7.4-imap php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-zip php7.4-mbstring php7.4-soap php7.4-opcache libonig5 php7.4-common php7.4-json php7.4-readline php7.4-xml

5.6PHP8.0をインストール

PHP 8.0をインストールするには、次のコマンドを使用します:

apt-get install php8.0 php8.0-cli php8.0-cgi php8.0-fpm php8.0-gd php8.0-mysql php8.0-imap php8.0-curl php8.0-intl php8.0-pspell php8.0-sqlite3 php8.0-tidy php8.0-xsl php8.0-zip php8.0-mbstring php8.0-soap php8.0-opcache libonig5 php8.0-common php8.0-readline php8.0-xml

5.6PHP8.1をインストールする

PHP 8.1をインストールするには、次のコマンドを使用します:

apt-get install php8.1 php8.1-cli php8.1-cgi php8.1-fpm php8.1-gd php8.1-mysql php8.1-imap php8.1-curl php8.1-intl php8.1-pspell php8.1-sqlite3 php8.1-tidy php8.1-xsl php8.1-zip php8.1-mbstring php8.1-soap php8.1-opcache libonig5 php8.1-common php8.1-readline php8.1-xml

6 Memcache拡張機能をインストールします(オプション)

Memcacheをインストールするには、次のコマンドを使用します:

apt-get install php-memcache php-memcached

7 APCu拡張機能をインストールします(オプション)

APCユーザーキャッシュをインストールするには、次のコマンドを使用します:

apt-get install php-apcu php-apcu-bc

8 xDebug拡張機能をインストールします(オプション)

xDebugモジュールは、PHPのデバッグ拡張機能です。インストールはオプションです。

xDebugをインストールするには、次のコマンドを使用します:

apt-get install php-xdebug

このパッケージには、Debianパッケージphp5-xdebug以外のデフォルト設定があるようです。ソフトウェアによっては、xdebug.max_nesting_levelなどの設定を変更して実行する必要があります!

9DebianのデフォルトのPHPを元のバージョンに戻します

オペレーティングシステムのデフォルトのPHPは、元のバージョンのままにする必要があります。これを修正するには、次のコマンドを実行します。

update-alternatives --config php
update-alternatives --config php-cgi

Debian 11では、7.4を選択し、Debian 10では、7.3を選択し、Debian 9では、PHP 7.0を選択し、Debian 8では、表示されるダイアログでPHP5.6を選択します。

10FPMデーモンを再起動します

最後に、php-fpmデーモンを再起動します。以前にインストールしたコマンドを実行します:

service php5.6-fpm restart
service php7.0-fpm restart
service php7.1-fpm restart
service php7.2-fpm restart
service php7.3-fpm restart
service php7.4-fpm restart
service php8.0-fpm restart
service php8.1-fpm restart
  • PHP:http://www.php.net/
  • ISPConfig:http://www.ispconfig.org/
  • Debian:http://www.debian.org/
  • DEB.SURY.ORG:http://deb.sury.org/

Debian
  1. Debian10にPHPComposerをインストールして使用する方法

  2. Debian7(Wheezy)でISPConfig3用のZendOPcacheとAPCuを使用してPHP5.6(PHP-FPM&FastCGI)を構築する方法

  3. Ubuntu/Debianにmodfastcgiを使用してApacheとphpをインストールして構成します

  1. Debian9にPHPComposerをインストールして使用する方法

  2. Debian 8(Jessie)にISPConfig3用のPHP7(PHP-FPM&FastCGI)をインストールする方法

  3. PHP7をPHPとしてインストールする方法-Debian8上のISPConfig3用のFPMおよびFastCGI(Jessie)

  1. 追加のPHPとしてPHP5.6をインストールする方法-Ubuntu16.04上のISPConfig3.1用のFPMおよびFastCGI

  2. PHP7.1.16をPHPとしてインストールする方法-Debian8(Jessie)上のISPConfig3.1用のFPMおよびFastCGI

  3. PHP 7.1、7.2、および5.6をPHPとしてインストールする方法-Debian9上のISPConfig3用のFPMおよびFastCGI