• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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