I want to install specific version of php for that i write this command sudo apt-get install php7.2
it’s showing like this
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php7.2-common' for regex 'php7.2'
Note, selecting 'php7.2-sodium' for regex 'php7.2'
Note, selecting 'libapache2-mod-php7.2' for regex 'php7.2'
Note, selecting 'php7.2-thrift' for regex 'php7.2'
0 upgraded, 0 newly installed, 0 to remove and 235 not upgraded.
after this when i want to know the version of php , i run php -v
i am getting following error
Command 'php' not found, but can be installed with: sudo apt install php7.4-cli # version 7.4.16-1ubuntu2.1, or sudo apt install php-cli # version 2:7.4+76ubuntu1
2
Answers
Try these steps:
1: Add Ondrej’s PPA, which contains the PHP 7.2 package:
2: Update:
3: Install PHP 7.2
4: Select the standard version of PHP
5: Restart Apache2:
Run the following commands it will work