• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Question PHP downgrade to all accounts - Plesk

Émerson Felinto

Regular Pleskian
How to apply a certain PHP version to all the sites of my Plesk server?
I have done this by service plan and it appears "Synchronizing ...". But when I access the client account (subscription) individually there still the same version continues. It seems Plesk only updates this version of PHP for new domains. How can I make this setting?

PS: I would like to downgrade from version 7.2 to 7.0 for all clients. If I uninstall PHP 7.2 in Plesk, will it automatically downgrade all sites to version 7.0?
 
a) in Plesk Panel go to "Tools & Settings" --> "PHP Settings" and click on the number on the right side of the current PHP version/handler these websites are configured now.
Copy & Paste this list of domains and save them into a text file on your server. (i.e. domains.txt)

b) run the following command on your server
Code:
for d in $(cat domains.txt); do plesk bin domain -u "$d" -php_handler_id plesk-php70-fpm; done

This would change the PHP handler for all these domains to v7.0 (provided by Plesk) running as FPM
 
Sure, most likely you need/want to use:
Code:
for d in $(cat domains.txt); do plesk bin domain -u "$d" -php_handler_id plesk-php70-fastcgi; done

But to make sure, you should check the available handler on the command line via "plesk bin php_handler --list"
Then use the correct name, listed under 'id' for the command above (instead of plesk-php70-fpm or plesk-php70-fastcgi)

You can also check the correct/favored PHP handler name in the Panel itself under "Tools & Settings" --> "PHP Settings"
Klick on the handler you want to use and then check the URL - the handler's name is the last part of it.
 
for d in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do plesk bin domain -u "$d" -php_handler_id plesk-php70-fastcgi; done

no need for a text file :D
 
If you REALLY want to change ALL sites, then you can use the direct approach via database command, but i'd recommend to use
for d in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains where htype='vrt_hst'"`; do plesk bin domain -u "$d" -php_handler_id plesk-php70-fastcgi; done
as this prevents unnecessary error messages for domains that do not have any php settings. (forwards, alias)

But I was under the impression that the OP "only" wanted to change the PHP 7.2 sites to 7.0, so my recommendation with the text file. (as I'm not able to construct the correct mysql query to select only such domains ;) )
 
Back
Top