Question
How to change PHP version for all domains in Plesk for Windows Server?
Answer
-
Connect to a Plesk server via RDP.
-
Create a list with the names of all domains with hosting:
C:> plesk db -Ne "select name from domains where htype='vrt_hst'" > C:domains.txt
-
List all installed PHP handlers:
C:> plesk bin php_handler --list
-
Run the following command:
Note: Replace <php_handler> with <id> of a PHP handler from step 4, which will be used by all domains:
C:> for /f "tokens=*" %d in ('type C:domains.txt') do plesk bin domain -u %d -php_handler_id <php_handler>
To change PHP version for all domains that use a specific PHP version, apply the following steps:
-
Create a list with the names of all domains that use a particular PHP version (in this example, PHP 5.6 FastCGI):
C:> plesk db -sNe "select name from hosting hos,domains dom where dom.id = hos.dom_id and php = 'true' AND php_handler_id LIKE 'fastcgi-5.6'" > c:domains.txt
-
Switch these domains to another PHP version (in this example, PHP 7.3 FastCGI):
C:> for /f "tokens=*" %d in ('type C:domains.txt') do plesk bin domain -u %d -php_handler_id fastcgi-7.3