2

I'm trying to upgrade Magento 2.4.2 to the latest release of Magento 2.4.3 How can I do this with the composer?

1

5 Answers 5

8

For community edition

composer require magento/product-community-edition=2.4.3 --no-update

For enterprise edition

composer require magento/product-enterprise-edition=2.4.3 --no-update
composer require magento/magento-cloud-metapackage=2.4.3 --no-update

=========Then fire below command==========

composer update
rm -rf var/di var/cache/ var/page_cache/ generated/code/
php bin/magento setup:upgrade
php bin/magento indexer:reindex
PHP bin/magento c:f

After upgrade, check your Magento version with the following command:

php bin/magento --version

2
  • i think these are the right removes for magento opensource rm -rf var/cache/* rm -rf var/page_cache/* rm -rf generated/code/*
    – eima
    Aug 17, 2021 at 8:13
  • yes @eima you are absolutely right, i have update answer, thank you Aug 17, 2021 at 9:57
4
1. change php version to 7.4
2. php bin/magento maintenance:enable
3. COMPOSER_MEMORY_LIMIT=-1  composer require magento/product-community-edition=2.4.3-p1 --no-update
4. open composer.json and remove amazon pay by adding it it under "replace" (only if you do not need and already installed)
     "require": {
                [...]
            },
            "replace": {
                "amzn/amazon-pay-sdk-php": "*",
                "amzn/amazon-pay-and-login-with-amazon-core-module": "*",
                "amzn/login-with-amazon-module": "*",
                "amzn/amazon-pay-module": "*",
                "amzn/amazon-pay-and-login-magento-2-module": "*"
            },
            "config": {
                [...]
  1. open composer.json and replace content of "require-dev"
    "require-dev": {
        "allure-framework/allure-phpunit": "~1.4",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
        "friendsofphp/php-cs-fixer": "~2.18.1",
        "lusitanian/oauth": "~0.8.10",
        "magento/magento-coding-standard": "*",
        "magento/magento2-functional-testing-framework": "^3.0",
        "pdepend/pdepend": "~2.7.1",
        "phpcompatibility/php-compatibility": "^9.3",
        "phpmd/phpmd": "^2.8.0",
        "phpstan/phpstan": "^0.12.77",
        "phpunit/phpunit": "^9",
        "sebastian/phpcpd": "^6.0.3",
        "squizlabs/php_codesniffer": "~3.5.4",
        "symfony/finder": "^5.2"
    },
6. COMPOSER_MEMORY_LIMIT=-1 composer update
7. redis-clis FLUSHALL
8. php bin/magento c:f
9. php bin/magento module:disable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch6,Magento_Elasticsearch7}
10. php bin/magento setup:upgrade
11. php bin/magento module:enable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch6,Magento_Elasticsearch7}
12. php bin/magento c:f
13. php bin/magento maintenance:disable

now login to admin -> configuration -> catalog and configure elastic search.

2
  • composer update takes too much time and there is not response, approx. how much time have to wait for it ? Dec 23, 2021 at 9:35
  • 1
    usually it take up to 30min or sometimes more than 1 hour. keep wait until it start upgrade process and press enter in SSH after every 5-10min. so it will not timeout
    – akashmalik
    Dec 27, 2021 at 14:20
3

Run the below commands :

composer require magento/product-community-edition 2.4.3 --no-update

composer update

2
  • composer update gives blank with no any result, its been around 1hr+, how much it should take ? Dec 23, 2021 at 9:36
  • 1
    Check any log file generate or something. Generally it can't take this much of time. Dec 23, 2021 at 9:50
0

Enable Maintenace mode

php bin/magento maintenance:enable

Backup composer.json file

cp composer.json composer.json.bak

Update composer.json file with latest version

composer require magento/product-community-edition=2.4.3 --no-update

If you get an error related to allure-framework/allure-phpunit and phpunit/phpunit package, change the version of those two packages in the composer.json file from the vanilla 2.4.3 version and run the above command again.

Update packages

composer update

This command will take some time to finish.

Clear cache and regenerate code.

php bin/magento cache:clean

rm -rf var/cache/*

rm -rf var/page_cache/*

rm -rf generated/code/*

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

Disable maintenance mode

php bin/magento maintenance:disable

For more information follow this step by step upgrade guide.

0

I believe the above answers will help, but...

no one mentioned --use-default-magento-values during updating, it will help the composer to update Magento composer dependencies in the composer.json file.

I'd recommend using the following command

composer require magento/product-community-edition=2.4.3-p1 --no-update --use-default-magento-values

And check your composer file, If you are okay with composer.json file changes, so run composer update command, Otherwise, you need to run the following command:

composer require magento/product-community-edition=2.4.3-p1 --no-update --interactive-magento-conflicts to interact with the magento changes provided then run composer update command.

I hope this answer may help someone to upgrade Magento to the current latest stable version.

-- Update --

Magenot updated the documentation for this commands like the following: Choose one of the following composer commands based on the PHP version, and run the command to upgrade your instance.

For 7.3 or higher:

composer require-commerce magento/<product> <version> --no-update [--interactive-root-conflicts] [--force-root-updates] [--help]

For PHP 7.2 or lower:

composer require magento/<product> <version> --no-update [--interactive-magento-conflicts] [--use-default-magento-values] [--help]

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.