I am a new Linux Mint user. In my computer I found PHP version 7.1 from phpinfo() like below
phpinfo()
I found PHP version 7.4.3 from terminal like below
My /etc/php/ folder is like below
Which PHP version am I using ?
4
Try in your terminal
which php
your will find your terminal PHP path.
You have multiple versions installed and you’re using the version that PHP tells you you are using.
When you use the webserver module version of PHP it is version 7.1.33. When you use the command line version you are using 7.4.3.
You might also have 7.0 and 7.2 installed (or they may be folders for leftover config files in versions that have since been uninstalled).
Disable php 7.1 module on Apache
sudo a2dismod php7.1
and enable php 7.4
sudo a2enmod php7.4 sudo systemctl restart apache2
The php version used by the CLI and the one used by apache CAN be different. The installed versions are listed in your /etc/php/ folder as you already emntioned.
/etc/php/
To switch the used version for apache you can use the following commands:
sudo a2dismod php7.1 sudo a2enmod php7.4
Also you have to restart your apache afterwards.
Reference: https://serverfault.com/questions/149039/how-to-change-what-version-of-php-apache2-uses
Click here to cancel reply.
4
Answers
Try in your terminal
your will find your terminal PHP path.
You have multiple versions installed and you’re using the version that PHP tells you you are using.
When you use the webserver module version of PHP it is version 7.1.33. When you use the command line version you are using 7.4.3.
You might also have 7.0 and 7.2 installed (or they may be folders for leftover config files in versions that have since been uninstalled).
Disable php 7.1 module on Apache
and enable php 7.4
The php version used by the CLI and the one used by apache CAN be different.
The installed versions are listed in your
/etc/php/
folder as you already emntioned.To switch the used version for apache you can use the following commands:
Also you have to restart your apache afterwards.
Reference: https://serverfault.com/questions/149039/how-to-change-what-version-of-php-apache2-uses