• 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!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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