PHP Settings¶
Plesk provides full support for the PHP scripting language, including support for multiple PHP versions and handler types out of the box. This topic explains how Plesk customers can manage PHP settings for their domains and subdomains from the Customer Panel.
PHP management on the domain level has three aspects:
- Choosing the PHP version.
- Choosing the PHP handler type.
- Configuring additional PHP settings.
Note
You may only be able to manage some of the settings described below, 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.
Choosing the PHP version¶
Plesk supports multiple PHP versions out of the box. To choose the PHP version for your domain or subdomain, go to Websites & Domains > PHP settings and select the desired PHP version from the menu:
If the desired PHP version is missing from the menu, contact your hosting provider.
Note that different PHP versions are not 100% compatible. A website written in PHP 5.3 may not function correctly if you configure PHP version 5.4 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, switch to a different PHP version.
Choosing the handler type¶
Plesk supports a number of different PHP handlers out of the box. To choose the PHP handler type for your domain or subdomain, go to Websites & Domains > PHP settings and select the desired PHP handler type from the menu:
Depending on the PHP version and operating system on your Plesk server, you can select one of the following PHP handlers:
- For Plesk on Linux:
- FastCGI application run by Apache.
- FPM application served by Apache.
- FPM application served by nginx.
- Dedicated FPM application served by Apache.
- Dedicated FPM application served by nginx.
- For Plesk on Windows:
- FastCGI application.
- ISAPI extension (outdated, only supports PHP 5.3 and earlier).
If you are not sure what PHP handler type to choose, learn about the different PHP handler types.
Dedicated PHP-FPM handler¶
Note
Before you turn on the dedicated PHP-FPM handler, take into account the following:
- The handler works with PHP version 7.3 or later.
- The handler increases OPcache memory consumption.
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:
Configuring additional settings¶
In addition to the PHP version and handler type, there are a number of PHP settings you can manage at Websites & Domains > PHP settings. These settings are mostly performance and security-related, but some of them may affect the operation of websites. Click the icon next to an option to learn more about it.
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. To switch on PHP acceleration,
go to Websites & Domains > PHP Settings and set the value of
opcache.enable
to “on
”.
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.