6

How to upgrade Magento 2.3.3 to Magento 2.4?

1

3 Answers 3

18

First take to older version website backup and after your run direct magento 2.4.0 version.

Magento Open Source:

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

Magento Commerce:

composer require magento/product-enterprise-edition=2.4.0 --no-update

And you want to read more information check this :-

https://experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/implementation/perform-upgrade.html

UPDATE:-

I will explain more in how to update latest magento version (2.4 at the moment):

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

If you are running Magento 2 commerce the command will be slightly different:

composer require magento/product-enterprise-edition=2.4.0 --no-update
composer update

Replace 2.4 with the latest M2 version.

When it is completed, run another SSH command and upgrade the Magento database:

php bin/magento setup:upgrade

After that you will want to recompile if you are in production mode:

php bin/magento deploy:mode:set production

UPDATE:- 15-AUG-2022

If you want to upgrade Magento to the most recent version, such as 2.4.4, then follow the below setup.

First, you need to setup PHP version 8.1 for Magento 2.4.4. Then you can run below command.

Magento Open Source:

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

Magento Commerce:

composer require magento/product-enterprise-edition=2.4.4 --no-update
composer update

If you have any issues upgrading Magento, you can use a flag like below as a temporary solution.

composer update --ignore-platform-reqs

https://github.com/magento/magento2/issues/29350

You’ve successfully performed a Magento 2 upgrade! Now go to the frontend and backend and check everything.

3
  • a quick note you might have to set the memory limit in your php-cli to be higher than the default. Also, --no-dev on the composer update limits the memory use as well
    – iphigenie
    Aug 7, 2020 at 14:15
  • 1
    What do you do about php version? Some of the plugins don't want to update because of php 7.2, but changing to 7.4 creates new errors
    – web master
    Sep 29, 2020 at 15:16
  • PHP 7.3 during the upgrade then switch to php 7.4. Also install Elastic search. Not sure what else needs to change Mar 8, 2021 at 10:15
3

In addition to above response which is fully correct, you can find this guide that I wrote and give all instructions plus a few more tricks: here

If you have MariaDB you will need to upgrade it, which is not straightforward but explained in that article. Also if you were not running with Elasticsearch as your default search engine you will need to install it and configure magento to do it.

2

First of all, we need to prepare for upgrade our site.

You have configure your server that works with php 7.4 and elasticsearch. You should read system requirement official document. Magento 2 System requirement official link

Check your PHP version, it should be 7.4

php -v

you have configured your server that works with Elasticsearch 7.9.x. As per the release notes of Magento 2.4.3, is recommended to use Elasticsearch 7.9.x. You can apply the below-given command to verify your version of Elasticsearch

curl -XGET 'http://localhost:9200'

You need to require composer version 2. Check your composer version using below command

composer -v

if composer version is 1 then you should upgrade using below command

composer self-update --2

Now backup your database as well as code.

Upgrade Magento Version from 2.3.X to 2.4.3

  1. Enable maintenance mode if you are performing on live site

    php bin/magento maintenance:enable
    
  2. Grab backup composer.json using the below command

    cp composer.json composer.json.bak
    
  3. Run the below command to update the composer.json file

    For Magento Open Source, run command:

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

    For Magento Commerce, run the command:

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

4: Run the following command

composer update

It will take some time to get completed.

After you are done with the above steps fire below given commands.

  1. 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
    
  2. Run this command in production mode:

    php bin/magento deploy:mode:set production
    
  3. At last don’t forget to disable maintenance mode

    php bin/magento maintenance:disable
    

That’s it you are upgraded to Magento 2.4.3

Your Answer

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

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