Question
Currently, new domains are being created with an unwanted PHP version.
-
How to set another default PHP version for new subscriptions?
-
How to change the default PHP version/handler assigned for newly created service plans?
Answer
Plesk
Change the PHP version for one existing subscription:
-
Go to Subscriptions > example.com > Websites & Domains > Hosting Settings > PHP version.
-
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.
-
Go to Service Plans select the wanted Service Plan, for example, Unlimited and select the tab PHP Settings.
-
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:
-
In Plesk go to Tools & Settings > Event Manager and click Add Event Handler
-
Select the event Service plan of administrator created and paste the command below to the Command field:
/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
-
Create an additional event handler for Service plan of reseller created and paste the command below to the Command field:
/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 displayed in the PHP Handler list, which can be viewed by following the steps in Retrieve the PHP Handler table
Note: It might be possible, that Plesk does not allow managing service plans via the web interface, this can be the case for example for Web Admin Edition or Web App Edition, it is possible to manage them via command line utilities, as described below.
Command Line
Retrieve the PHP Handler table:
-
Connect to the server via SSH.
-
Retrieve the PHP Handler table:
# [[email protected] ~]# plesk bin php_handler –list
id: display name: full version: version: type: cgi-bin: php-cli…