概要: Plesk provides support for multiple PHP versions and handler types out of the box.

In this topic you will learn how to install additional PHP versions in Plesk.

Installing and Uninstalling PHP Versions

若要在伺服器上安裝某個 PHP 版本或從伺服器上移除某個 PHP 版本,請按照下面的步驟操作:

  1. Go to Tools & Settings > Updates (under 「Plesk」), and then click Add/Remove Components.

    • (Plesk for Linux) 展開 主機 部分,然後找到 PHP interpreter 版本 部分。
    • (Plesk for Windows) 展開 Plesk 主機功能 部分。
  2. Here, currently installed PHP versions are marked with a green checkbox icon, and those currently not installed with a red cross icon. Select the PHP versions you want to install by clicking the corresponding icon > Install. Select the PHP versions you want to remove by clicking the corresponding icon > Remove. On the screenshot below, PHP versions 8.3, 8.2, 8.1, and 7.4 are marked for installation, while PHP version 8.0 - for removal.

    image php versions

  3. 點按 繼續 安裝/移除所選的 PHP 版本。

不管什麼時候安裝 PHP 版本,Plesk 都會自動為其配置標準的 PHP 處理常式類型 (CGI, FastCGI, PHP-FPM)。

備註: 在諸如 CentOS 6.x 等更早的系統上,需要安裝 來自作業系統供應商的 PHP-FPM 支援 組件以啟用 PHP-FPM 處理常式。該組件可在 添加/移除組件 標籤中的 主機 > Nginx web 伺服器與反向代理伺服器 部分查找。

備註: 在更新的作業系統(例如 Debian 9)上,可能無法安裝 PHP 舊版本(5.6 和更早版本),因為這些版本與更新的作業系統附帶的 OpenSSL 版本不相容。

您可以為每個在伺服器上安裝的 PHP 版本 設定某個處理常式類型可用或不可用 (例如,您可以允許您的客戶可同時使用 FastCGI 和帶有 PHP 8.3 的 PHP-FPM,但是只能使用帶有 PHP 8.1 的 PHP-FPM)。您還可以為每個 PHP 版本單獨 配置 PHP 設定

備註: 在 Plesk Obsidian 和更新版本中,系統 PHP 元件不再是強制性的。現在您可以:

  • 在沒有系統 PHP 元件的情況下安裝 Plesk。
  • 在安裝或升級到 Plesk Obsidian 後移除系統 PHP 元件。
  • 安裝和使用自訂的 PHP 版本而非系統 PHP 元件。
  • 在沒有系統 PHP 元件的情況下安裝 Horde。