Plesk

How to set another default PHP version for new subscriptions in Plesk?

Question

Currently, new domains are being created with an unwanted PHP version.

Answer

Via Plesk Interface

Change the PHP version for one existing subscription:

  1. Log into Plesk.

  2. Go to Subscriptions > example.com > Websites & Domains > Hosting Settings > PHP version.

  3. Now select the wanted PHP Version, for example, 7.2.11, then scroll down and press OK:

Change the PHP version for all newly created Subscriptions using some Service Plan:

Note: This method will also change the PHP Versions of existing subscriptions if the Common PHP settings management permission is not set.

  1. Log into Plesk.

  2. Go to Service Plans select the wanted Service Plan, for example, Unlimited and select the tab PHP Settings.

  3. Now select the wanted PHP Version, for example, 7.2.11, then scroll down and press OK:

Note: The steps have to be repeated for each Service Plan, in which the PHP Handler should be updated.

Change the PHP version for all newly created Service Plans:

This functionality is yet to be implemented in Plesk.

However, a corresponding request already exists on Plesk User Voice. Leave a vote there - top-ranked suggestions are likely to be included in next versions of Plesk.

As a workaround it is possible to create 2 event handlers (for service plans created by the administrator and by resellers), which will setup wanted PHP version and handler for future service plans:

  1. In Plesk go to Tools & Settings > Event Manager and click Add Event Handler

  2. Select the event Service plan of administrator created and paste the command below to the Command field:

    CONFIG_TEXT:/usr/local/psa/bin/service_plan -u "$(plesk db -Ne'select name from Templates ORDER BY id DESC LIMIT 1;')" -owner $(plesk db -Ne'select login from clients where id = (select owner_id from Templates ORDER BY id DESC LIMIT 1);') -php_handler_id plesk-php71-fpm

  3. Create an additional event handler for Service plan of reseller created and paste the command below to the Command field:

    CONFIG_TEXT:/usr/local/psa/bin/service_plan -u "$(plesk db -Ne'select name from Templates ORDER BY id DESC LIMIT 1;')" -owner "$(plesk db -Ne'select login from clients where id = (select owner_id from Templates ORDER BY id DESC LIMIT 1);')" -php_handler_id plesk-php71-fpm

    Note: Instead of plesk-php71-fpm it is possible to use a different PHP handler, which is display…