PHP Management

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 administrator can make PHP available to their customers and control what PHP settings their customers can manage.

For a domain to use PHP, it has to be enabled on the subscription level. If the subscription is based on a service plan, it makes sense to enable PHP and configure the PHP settings in the service plan. For example, you can have a ‘basic’ plan, which would give subscribers no control over PHP settings, and ‘advanced’ one, which would give some degree of control, and an ‘expert’ one, which would allow subscribers the maximum ability to customize the PHP settings.

When setting up a service plan or a subscription, PHP-related tasks include the following:

  • Configuring the PHP settings.
  • Setting up permissions. These will define what PHP settings subscribers can manage.

Multiple PHP Versions

Most PHP versions are not backward-compatible. For example, code written in PHP 5.x might not execute correctly when being run using a PHP 4.x interpreter. For additional flexibility, Plesk ships with a number of PHP versions that can be installed via the Plesk interface. Customers granted the PHP version and handler management permission are able to select the PHP handler and version independently for each of their websites.

Configuring the PHP settings

To configure the PHP settings for a service plan, go to Service Plans > click either Add a Plan or the name of an existing plan whose PHP settings you want to change > PHP Settings. To configure the PHP settings for a subscription, go to Subscriptions > click either Add Subscription or the name of an existing subscription whose PHP settings you want to change and then Customize > PHP Settings. On this page you are able to do the following:

  • Define the PHP version and handler type to use. This setting is only available on the service plan level.

  • Configure a range of predefined PHP settings. These settings are mostly performance and security-related, but some of them may affect the website functionality. Click the image-0 icon next to an option to learn more about it.

  • Configure any PHP settings by placing them in the Additional directives section. Use the same syntax as you use for php.ini. For example, if you want to automatically load the mSQL extension, add the line: extension=msql.so.

    Note

    Setting additional PHP directives is available to the administrator only and is never available to a customer. When the administrator sets additional PHP directives to a particular subscription, the subscription does not get the Locked status. Therefore, the added directives and other changes in PHP settings can be lost when the subscription is synchronized with the service plan.

These settings will become the default ones for objects of lower levels. In other words, settings configured on the service plan level will become the default for all subscriptions based on that service plan, and settings configured on the subscription level will become the default for all domains based on that subscription.

Setting up permissions

To configure the PHP settings for a service plan, go to Service Plans > click either Add a Plan or the name of an existing plan whose PHP settings you want to change > Permissions. To configure the PHP settings for a subscription, go to Subscriptions > click either Add Subscription or the name of an existing subscription whose PHP settings you want to change and then Customize > Permissions. On this page the following permissions govern the ability to change the PHP settings:

  • Common PHP settings management. Granting this permission will enable the customer to select the PHP version and manage a number of predefined general PHP settings.
  • Hosting performance settings management. Granting this permission will enable the customer to manage performance-related PHP settings.
  • PHP version and handler management. Granting this permission will enable the customer to select the PHP version and the PHP handler type.
  • Setup of potentially insecure web scripting options that override provider’s policy. Granting this permission will enable the customer to manage certain settings related to website isolation.

Note that some of these permissions can be granted without granting the Hosting settings management permission first.

Inheriting PHP settings

Note that in Plesk local settings override global ones. This means that, for example, settings defined on the subscription level take precedence over those defined on the service plan level, but are, in turn, overridden by those defined on the domain level.

Note

If you change the PHP settings for a subscription, the subscription will be locked for sync unless the subscription owner has the necessary permissions to make the changes you made.

This scheme illustrates the hierarchy, from the topmost level to the bottom:

image-1