概要: 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。