Skip to content

Instantly share code, notes, and snippets.

@vjandrea
Last active June 19, 2023 20:44
Show Gist options
  • Save vjandrea/132a15186fa0193fb764 to your computer and use it in GitHub Desktop.
Save vjandrea/132a15186fa0193fb764 to your computer and use it in GitHub Desktop.
Change php cli version in plesk
#!/bin/sh
printf "Switching php to version 5.6 with symlinks.\n"
printf "Press any key to continue...\n"
read CONTINUE
printf "Creating backups..."
# Backup original binaries
mv /usr/bin/php /usr/bin/php.backup
mv /usr/bin/php-cgi /usr/bin/php-cgi.backup
# mv /usr/bin/phpize /usr/bin/phpize.backup
printf " done.\n\n"
printf "Creating symlinks..."
# Create symlinks to the plesk ones
ln -s /opt/plesk/php/5.6/bin/php /usr/bin/php
ln -s /opt/plesk/php/5.6/bin/php-cgi /usr/bin/php-cgi
# ln -s /opt/plesk/php/5.6/bin/phpize /usr/bin/phpize
printf " done.\n\n"
printf "Process completed.\n"
printf "PHP version is:\n"
php -v
printf "\nand PHP binary path is:\n"
which php
printf "\n\n"
@kemalyen
Copy link

great, solved my problem without any headache

@n3b0r
Copy link

n3b0r commented Nov 28, 2016

Works perfectly in Plesk 12.5.

Great Job ! ;)

@bnd170
Copy link

bnd170 commented Nov 29, 2016

Good Job. It worked perfectly

@isbkch
Copy link

isbkch commented Dec 4, 2016

Sweet ! Thx budd

@benhogg27
Copy link

Perfect in Plesk 12.5. Many thanks :)

@jonberrydotnet
Copy link

Thanks! Worked great on the new Plesk Onyx.

@jonhenryjon
Copy link

jonhenryjon commented Jan 30, 2017

Works great! Plesk Onyx

Copy link

ghost commented Feb 14, 2017

Thx !!

@maxplus
Copy link

maxplus commented Mar 2, 2017

Thanks,
worked for me in Plesk Onyx (Version 17.0.17 Update #17)

@modpluz
Copy link

modpluz commented May 21, 2017

Thanks! Works perfect in Plesk 12.5.30

@h3llr4iser
Copy link

Works on plesk 17.5.3

@slepciu
Copy link

slepciu commented Oct 31, 2017

worked for me on plesk 17.5.3

@m-hcb
Copy link

m-hcb commented Feb 14, 2018

you are a life saver

@Scarwolf
Copy link

This needs to be done with Root right? How do I obtain roots credentials from Plesk?

@neilw84
Copy link

neilw84 commented May 22, 2018

I've used this on several servers and all works ok except one seems to keep reverting back to an older version now and again, I assume some plesk update is overwriting the change, anyone know how to stop that from happening?

@tasz
Copy link

tasz commented Oct 7, 2019

Thanks it work for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment