• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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