How to change php version in shell

If you have multiple versions of PHP and you want to change PHP version in shell then run following command:

This will give you a list of all PHP versions installed:

Find version that you need (i.e. /usr/bin/php71).

Then open .bashrc (or .bash_profile) and add the following line to the end of the file:

Start new SSH session into your server and any “php” command will now use the php version specified in the .bashrc (or .bash_profile).

Verify your php version:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">