Create a gist now

Instantly share code, notes, and snippets.

Embed
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"
@victorlap

This comment has been minimized.

Show comment
Hide comment
@victorlap

victorlap Mar 6, 2016

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)

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

This comment has been minimized.

Show comment
Hide comment
@gazatem

gazatem Jul 10, 2016

great, solved my problem without any headache

gazatem commented Jul 10, 2016

great, solved my problem without any headache

@vgsystems

This comment has been minimized.

Show comment
Hide comment
@vgsystems

vgsystems Nov 28, 2016

Works perfectly in Plesk 12.5.

Great Job ! ;)

Works perfectly in Plesk 12.5.

Great Job ! ;)

@bnd170

This comment has been minimized.

Show comment
Hide comment
@bnd170

bnd170 Nov 29, 2016

Good Job. It worked perfectly

bnd170 commented Nov 29, 2016

Good Job. It worked perfectly

@isbkch

This comment has been minimized.

Show comment
Hide comment
@isbkch

isbkch Dec 4, 2016

Sweet ! Thx budd

isbkch commented Dec 4, 2016

Sweet ! Thx budd

@benhogg27

This comment has been minimized.

Show comment
Hide comment
@benhogg27

benhogg27 Dec 14, 2016

Perfect in Plesk 12.5. Many thanks :)

Perfect in Plesk 12.5. Many thanks :)

@jonberry1976

This comment has been minimized.

Show comment
Hide comment
@jonberry1976

jonberry1976 Jan 17, 2017

Thanks! Worked great on the new Plesk Onyx.

Thanks! Worked great on the new Plesk Onyx.

@jblakely86

This comment has been minimized.

Show comment
Hide comment
@jblakely86

jblakely86 Jan 30, 2017

Works great! Plesk Onyx

jblakely86 commented Jan 30, 2017

Works great! Plesk Onyx

@ghost

This comment has been minimized.

Show comment
Hide comment

ghost commented Feb 14, 2017

Thx !!

@maxplus

This comment has been minimized.

Show comment
Hide comment
@maxplus

maxplus Mar 2, 2017

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

maxplus commented Mar 2, 2017

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

@modpluz

This comment has been minimized.

Show comment
Hide comment
@modpluz

modpluz May 21, 2017

Thanks! Works perfect in Plesk 12.5.30

modpluz commented May 21, 2017

Thanks! Works perfect in Plesk 12.5.30

@h3llr4iser

This comment has been minimized.

Show comment
Hide comment
@h3llr4iser

h3llr4iser Aug 30, 2017

Works on plesk 17.5.3

Works on plesk 17.5.3

@slepciu

This comment has been minimized.

Show comment
Hide comment
@slepciu

slepciu Oct 31, 2017

worked for me on plesk 17.5.3

slepciu commented Oct 31, 2017

worked for me on plesk 17.5.3

@m-hcb

This comment has been minimized.

Show comment
Hide comment
@m-hcb

m-hcb Feb 14, 2018

you are a life saver

m-hcb commented Feb 14, 2018

you are a life saver

@Scarwolf

This comment has been minimized.

Show comment
Hide comment
@Scarwolf

Scarwolf Mar 12, 2018

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

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

@neilw84

This comment has been minimized.

Show comment
Hide comment
@neilw84

neilw84 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?

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?

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