How to switch default php version in linux ?

Check which php versions are available with system

    sudo update-alternatives --config php

or else you can use following command to set each library

    sudo update-alternatives --set php /usr/bin/php7.2
    sudo update-alternatives --set phar /usr/bin/phar7.2
    sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
    sudo update-alternatives --set phpize /usr/bin/phpize7.2
    sudo update-alternatives --set php-config /usr/bin/php-config7.2

If still not able to set the default version than look for the $PATH for more details and check weather this directory has conflicts with existing binary or not.

    cat $PATH

Tags: linux, php

Related posts