I am try to install Magento 2.4.3 with the command in Ubuntu.

After follow all the steps, when I try to run the Magento from browser, it show me error like this :

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0".

If I check my php version, that is already 7.4.23

I also try

  1. composer update
  2. composer self-update

But still facing the same issue.

If anyone have solution then let me know.


5 Answers 5


There might be multiple PHP versions installed on the server. So you can run the below command to check that. which PHP; or whereis PHP;

Through this, you can get which PHP version is getting called.


You can have multiple installed PHP versions on your host, please, check which version is used by the composer with the next command - composer -vvv about

  • This is already show the PHP Version 7.4.23. Commented Sep 7, 2021 at 4:09

A simple Solution:

When you use php -v on shell, it will tell you which PHP version cli is using. But the composer could have use different php version if you have multi php installed.

To run composer with your desired php version, you can use this command

/usr/bin/php7.4 /usr/local/bin/composer update

or any other composer command with php version.

Note: If php location is different than /usr/bin/php7.4 then you can get location by using locate php

Other solution if found this: (But haven't tried it by myself)

Update your composer.json file, and add this php version configuration:

"config": {
    "platform": {
        "php": "7.1.3"

Hope this will help you

  • Try both solutions, but not working. Commented Sep 7, 2021 at 4:50
  • can you share the command that you have used with php version? Commented Sep 7, 2021 at 4:56
  • for magento I directly use "php bin/magento cache:clean" Commented Sep 7, 2021 at 9:34
  • php bin/magento cache:clean on this command you are getting error? Commented Sep 7, 2021 at 10:25
  • No, the command doesn't have any error. it run successfully. Commented Sep 7, 2021 at 10:48

I Check and found the solution that,

When I need to switch the PHP Version from 7.2 to 7.4 I need to run the command like this one.

sudo a2dismod php7.2
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart

If you use Nginx please give me your Nginx config.

Maybe It's happening by your Nginx configuration with php-fpm.

You can verify by yourself with echo phpinfo(); in /pub/index.php to check your PHP version running with Webserver.

  • I already write, I use Ubuntu with MySQL and this is into the local environment. Commented Sep 10, 2021 at 4:43
  • I mean your PHP CLI is different from PHP running on a web server like apache, or nginx, php-fpm. We must use phpinfo(); in code to make sure correct PHP version.
    – Dylan Ngo
    Commented Sep 10, 2021 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.