5

Magento 2.3.5

I am trying to update from Magento 2.3.5 to Magento 2.4.4-p2. The commands I executed are:

composer require magento/product-community-edition=2.4.4-p2 --no-update --use-default-magento-values
composer update

I am running PHP 7.4 and the error I get is: magento/framework 102.0.5 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.30) does not satisfy that requirement.

Switching back to PHP 7.3 gives me: magento/product-community-edition 2.4.4-p2 requires php ~7.4.0||~8.1.0 -> your PHP version (7.3.33) does not satisfy that requirement.

How would I solve this?

Thanks!

2 Answers 2

3

You can apply one of 2 solutions below:

Solution 1: Firstly, switch to PHP 8.1, then update the composer.json file specifically the require-dev section with what is written here https://github.com/magento/magento2/blob/2.4.4-p2/composer.json

Then remove vendor folder and run the following commands:

composer remove magento/product-community-edition --no-update
composer require magento/composer-root-update-plugin ~2.0 --no-update
composer require-commerce magento/product-community-edition 2.4.4-p2 --no-update
composer update
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f

Solution2: Do the following steps:

  1. STAY IN PHP 7.3 (or PHP 7.4)
  2. composer require magento/composer-root-update-plugin ~2.0 --no-update
  3. composer update
  4. rm -rf var/cache/* var/page_cache/* generated/code/* ; bin/magento setup:upgrade
  5. composer require-commerce magento/product-community-edition 2.4.4-p2 --no-update
  6. composer update
  7. CHANGE TO PHP 8.1
  8. rm -rf var/cache/* var/page_cache/* generated/code/* ; bin/magento setup:upgrade; bin/magento setup:di:compile; bin/magento setup:static-content:deploy -f

Reference: https://github.com/magento/magento2/issues/35306

6
  • Thanks, when does the update take place in solution 1? I cant change to 7.2 or 7.3 and run the update, it will complain about minimum PHP version 7.4. Commented Oct 18, 2022 at 11:35
  • You should do solution 1. Only do solution 2 if you have issue: "Fatal error: During inheritance of Countable:..." when running bin/magento setup:upgrade after doing solution 1.
    – Tu Van
    Commented Oct 18, 2022 at 11:40
  • Ok, but where in solution 1 would the update take place if I only replace the require-dev part? Or should I use the full composer.json in my project? Commented Oct 18, 2022 at 19:08
  • I've updated solution 1, thanks for pointing me out.
    – Tu Van
    Commented Oct 19, 2022 at 1:08
  • 1
    Have you succeeded in this upgrade? If this answer work for you, please mark it as accepted, it makes it easier for others with the same issue to find a verified answer.
    – Tu Van
    Commented Oct 24, 2022 at 7:47
2

tldr, you should use PHP 8.1.

First of all, you shouldn't just run composer update. Instead, just run composer update magento/product-community-edition. It will update ALL your dependencies. If problems occur, you have no idea where they come from. Then, Magento 2.4.4 runs with PHP 8.1. You want to use the latest Version as PHP 7.4 is almost out of its lifecycle and will die in a few weeks.

2
  • Thanks, I ran composer update magento/product-community-edition and switched to PHP 8.1 before. This is what I got: pastebin.com/P8yt0QvR Commented Oct 18, 2022 at 9:14
  • Well, you have to read the output yourself. Specific dependencies are out of date and need to be updated as well. You can get an overview of what has to be updated by running composer outdated -D. Commented Oct 18, 2022 at 9:53

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.