PHP Settings
summary: 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.
Note: 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.
If there is no PHP version shown next to the PHP icon, PHP is not enabled for the domain.
Configuring the PHP Version and Handler Type
Selecting the PHP version and handler type for a domain
-
Go to Websites & Domains, find the domain whose PHP version you want to change, and then click PHP.
-
Select the “PHP support” checkbox if it is clear.
-
Select the desired PHP version from the drop-down menu. If the desired PHP version is missing from the menu, contact your hosting provider.
-
Select the desired handler type from the drop-down menu.
-
Click OK.
The changes you made will take effect shortly.
Note: 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.
Note: 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
The dedicated PHP-FPM handler provides higher stability and isolation of websites by running a separate PHP master process for each website. This way, each website runs its scripts independently from other websites. It means that a website’s operation does not affect the operation of other websites, and is not affected in the following cases:
- Changing the website’s PHP settings.
- Changing the website’s PHP handler.
- Stopping, restarting, or crashing of the PHP master process.
- Errors in the website’s PHP scripts.
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:
Note: 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.
- The handler increases OPcache memory consumption.
Configuring Additional PHP Settings
In addition to the PHP version and handler type, you can set the values for a number of core php.ini directives from a domain’s PHP page. These are mostly performance and security-related, but some of them may affect the operation of the website. Click the icon next to a directive to learn more about it.
Configuring core php.ini directives for a domain
- Log in to Plesk.
- Go to Websites & Domains, find the domain whose core php.ini directives you want to change, and then click PHP.
- Make the desired changes by either selecting a value for a directive from the drop-down menu or, if the value is non-boolean, entering a custom value into the corresponding field, and then click OK.
The changes you made will take effect shortly.
If your domain uses one of the “FPM application” PHP handlers, you can configure additional PHP-FPM settings. They can be used to fine-tune PHP behavior to optimize your website’s performance.
The default values of these settings should be optimal for most websites. Keep in mind that changing these settings may impact the performance of your website or even prevent it from displaying correctly. Unless you are sure what changes you need to make, it is recommended to keep the default values for all additional settings. If you make changes to the PHP settings and your website becomes slow or stops loading, return all PHP settings to their default values.
Enabling PHP Acceleration
If your hosting provider allows it, you may be able to switch on PHP acceleration, also known as opcode cache module, for your website. If your website is written in PHP, enabling the opcode cache module can speed it up by a factor of two or more.
Enabling PHP acceleration for a domain
- Log in to Plesk.
- Go to Websites & Domains, find the domain you want to enable PHP acceleration for, and then click PHP.
- Set the value of
opcache.enable
toon
, and then click OK.
The change will take effect shortly.
Viewing the PHP settings
To view the PHP settings currently configured for the domain, including those configured on the server level, click View the phpinfo() page.
Inheriting PHP settings
Domains belonging to a subscription inherit the PHP settings defined on the subscription level. Subdomains inherit the PHP settings defined on the level of their parent domain. If you have the corresponding permissions on your subscription, you can change the PHP settings for every domain and subdomain independently of each other.