Содержание: Plesk provides support for the PHP scripting language, including support for multiple PHP versions and handler types out of the box.

In this topic, you will learn how to manage PHP settings for domains in Plesk.

Plesk supports multiple PHP versions out of the box. You can configure individual domains to use different combination of PHP version and handler, and also configure additional PHP settings on a per-domain basis.

Примечание: You may only be able to manage some of the settings, or none at all, depending on your subscription settings. If you need to manage PHP settings that are unavailable to you, contact your hosting provider.

You can see the currently selected PHP version next to the PHP icon right on the domain card.

image php version

If there is no PHP version shown next to the PHP icon, PHP is not enabled for the domain.

image php disabled

Configuring the PHP Version and Handler Type

Selecting the PHP version and handler type for a domain

  1. Войдите в Plesk.

  2. Go to Websites & Domains, find the domain whose PHP version you want to change, and then click PHP.

  3. Select the «PHP support» checkbox if it is clear.

  4. Select the desired PHP version from the drop-down menu. If the desired PHP version is missing from the menu, contact your hosting provider.

    image php version selector

  5. Select the desired handler type from the drop-down menu.

    image php handler selector

  6. Нажмите OK.

The changes you made will take effect shortly.

Примечание: Different PHP versions are not 100% compatible. A website written in PHP 8.x may not function correctly if you configure a different PHP version for the domain. If you are not sure what PHP version to choose, use the default setting or the latest version available. If your website is not displaying correctly, try switching to a different PHP version.

Примечание: What PHP handler(s) are available for a domain depends on the selected PHP version and your Plesk server’s operating system. If you are not sure what PHP handler type to choose, learn about the different PHP handler types.

Using the Dedicated PHP-FPM Handler

Выделенный обработчик PHP-FPM обеспечивает более высокую стабильность и изоляцию сайтов, запуская отдельный основной процесс PHP для каждого сайта. Таким образом, каждый сайт запускает свои скрипты независимо от других сайтов. Это означает, что работа сайта не влияет на работу других сайтов и не затрагивается в следующих случаях:

  • Изменение настроек PHP для сайта.
  • Изменение обработчика PHP для сайта.
  • Остановка, перезапуск или сбой основного процесса PHP.
  • Ошибки в PHP-скриптах сайта.

When the dedicated PHP-FPM handler is turned on for a website, you can start, stop, or restart its PHP master process from the domain’s PHP page:

image control php master process

Примечание: Before selecting the dedicated PHP-FPM handler for a domain, take the following into account:

  • The handler only works with PHP version 7.3 or later.
  • Обработчик увеличивает потребление памяти OPcache.

Дополнительные настройки PHP

In addition to the PHP version and handler type, there are a number of PHP settings you can manage from a domain’s PHP page. These settings are mostly performance and security-related, but some of them may affect the operation of websites. Click the image question mark icon next to an option to learn more about it.

Configuring additional PHP settings for a domain

  1. Войдите в Plesk.
  2. Go to Websites & Domains, find the domain whose PHP settings you want to change, and then click PHP.
  3. Внесите необходимые изменения и нажмите OK.

The changes you made will take effect shortly.

Если ваш домен использует один из обработчиков PHP типа «Приложение FPM», вы можете настроить дополнительные параметры PHP-FPM. Они могут быть полезны для регулирования поведения PHP с целью оптимизации производительности сайта.

Значения этих настроек по умолчанию должны быть оптимальны для большинства сайтов. Имейте в виду, что изменение этих настроек может повлиять на производительность вашего сайта или даже привести к его некорректному отображению. Рекомендуем вносить изменения только тогда, когда вы уверены в их необходимости, или использовать значения по умолчанию для всех дополнительных настроек. Если вы изменили настройки PHP и ваш сайт стал работать медленно или перестал загружаться, верните все настройки PHP к значениям по умолчанию.

Включение ускорения работы PHP

Вы можете включить для своего сайта ускорение работы PHP, также известное как модуль кэширования opcode, если это разрешено хостинг-провайдером. Если ваш сайт написан на PHP, включение модуля кэширования opcode может ускорить его работу вдвое или больше.

Enabling PHP acceleration for a domain

  1. Войдите в Plesk.
  2. Go to Websites & Domains, find the domain you want to enable PHP acceleration for, and then click PHP.
  3. Set the value of opcache.enable to on, and then click OK.

The change will take effect shortly.

Просмотр настроек PHP

Для просмотра текущих настроек PHP домена, включая заданные на уровне сервера, нажмите Просмотр страницы phpinfo().

Наследование настроек PHP

Домены, принадлежащие подписке, наследуют настройки PHP, определенные на уровне подписки. Субдомены наследуют настройки PHP, определенные на уровне их родительского домена. Если ваша подписка обладает соответствующими правами, вы можете изменять настройки PHP для каждого домена и субдомена независимо друг от друга.