Solved - phpinfo() and php -v shows different version of PHP

By Hardik Savani November 5, 2023 Category : Ubuntu

In this tute, we will discuss phpinfo() and php shows different version of php. if you want to see example of php version different phpinfo then you are a right place. we will help you to give example of phpinfo showing different version. step by step explain php -v shows different version.

Few days ago i upgrade my php version 7.3 to 7.4 in ubuntu system. it's installed everything well with php 7.4 but when i try to rum "php -v" command then it still shows old version of php.

after google search i found solution how to resolve it. you have to run update-alternatives command choose current version from list.

Let's run bellow command:

sudo update-alternatives --config php

now there will be a list of installed php cli, choose what you want to keep. as like bellow screen shot:

now run bellow command to restart:

sudo service apache2 restart

I hope it can help you...

Tags :