Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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"

Thank you very much! This worked for me!
Only issue I encountered was:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/plesk/php/5.6/lib64/php/modules/twig.so' - /opt/plesk/php/5.6/lib64/php/modules/twig.so: cannot open shared object file: No such file or directory in Unknown on line 0PHP 5.6.18 (cli) (built: Feb 11 2016 11:49:12)

gazatem commented Jul 10, 2016

great, solved my problem without any headache

Works perfectly in Plesk 12.5.

Great Job ! ;)

bnd170 commented Nov 29, 2016

Good Job. It worked perfectly

isbkch commented Dec 4, 2016

Sweet ! Thx budd

Perfect in Plesk 12.5. Many thanks :)

Thanks! Worked great on the new Plesk Onyx.

jblakely86 commented Jan 30, 2017 edited

Works great! Plesk Onyx

Hesiode commented Feb 14, 2017

Thx !!

maxplus commented Mar 2, 2017

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

modpluz commented May 21, 2017

Thanks! Works perfect in Plesk 12.5.30

Works on plesk 17.5.3

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