skip to Main Content

I am a new Linux Mint user. In my computer I found PHP version 7.1 from phpinfo() like below

enter image description here

I found PHP version 7.4.3 from terminal like below

enter image description here

My /etc/php/ folder is like below

enter image description here

Which PHP version am I using ?

4

Answers


  1. Try in your terminal

    which php
    

    your will find your terminal PHP path.

    Login or Signup to reply.
  2. 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).

    Login or Signup to reply.
  3. Disable php 7.1 module on Apache

    sudo a2dismod php7.1
    

    and enable php 7.4

    sudo a2enmod php7.4
    sudo systemctl restart apache2
    
    Login or Signup to reply.
  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:

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search