How to Upgrade Magento Version from 2.3.X to 2.4.0?

magento_2_upgrade_240

Magento 2.4.0 is released. As per release notes, it contains 98 new features, 50 security changes, support of 2FA in admin by default, and PHP 7.4 support. As a store owner or as a developer, you should never miss this crucial upgrade. Today we will see step by step guide to upgrade Magento version from 2.3.x to 2.4.0.

If you are running on Magento version 2.2.x then you should first upgrade it to 2.3.x by following this guide.

Preparing Your Site for Upgrade

  1. Make sure your server is configured to work with PHP 7.4. Magento 2.4.0 officially support only PHP 7.4. Though you can install Magento 2.4.0 with PHP 7.3 but it is not tested. So it is recommended to use PHP 7.4 with Magento 2.4.0. You can check your PHP version by running below command

    php -v

  2. Make sure your composer is pointing to correct PHP version 7.4. You can check your composer’s PHP version by running below command

    composer -vvv about

  3. Make sure your server has installed and configured Elasticsearch 7.6.x. Magento 2.4.0 does not support MySQL as a catalog search engine. You can check your Elasticsearch version by running below command

    curl -XGET ‘http://localhost:9200’

    OR

    curl -XGET ‘http://YOURDOMAIN:9200’

  4. Take a code and database backup. Many developers are already managing their code in git. For them, an only database backup is important as they can revert the code from git if the upgrade goes wrong.

Upgrade Magento Version from 2.3.X to 2.4.0

Step 1: If you are directly performing the upgrade on your live site then first put your site into maintenance mode by running below command.

php bin/magento maintenance:enable

Step 2: If you are performing the upgrade on your local system then you can skip step 1 and start with step 2.
Take a backup of the composer.json

cp composer.json composer.json.bak

Step 3: Install the Composer update plugin

composer require magento/composer-root-update-plugin=~1.0 --no-update

composer update

Step 4: Update composer.json file with latest version. In our case, it is Magento Version 2.4.0. Navigate to your Magento 2 installation root path and run below command

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

Step 5: Run below command

composer update

This command will take some time to finish. This command will actually download all the required packages and upgrade your Magento version from 2.3.x to 2.4.0. After this command finish, run below commands

Step 6: 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

Step 7: Disable maintenance mode

php bin/magento maintenance:disable

Note: Remove update directory from your root folder as update directory is not a part of Magento 2.4

Want to ask a question or leave a comment?

Leave a Comment

(9 Comments)

  • pinkesh

    I followed the above instructions but I got the error
    The “magento/inventory-composer-installer” plugin was skipped because it requires a Plugin API version (“^1.1”) that does not match your Composer installation (“2.0.0”). You may need to run composer update with the “–no-plugins” option.
    The “laminas/laminas-dependency-plugin” plugin was skipped because it requires a Plugin API version (“^1.1”) that does not match your Composer installation (“2.0.0”). You may need to run composer update with the “–no-plugins” option.

    • Chirag

      Not sure how this error coming. But have you tried that composer update with the “-no-plugins”? and did it run successfully?

  • Rajesh Gohil

    hello,
    @sathish and @nidhi
    Please upgrade php version in last after magento upgrade finish 🙂
    this will fix your problem

  • Rahula Mohanty

    I want to upgrade magento 2.3.5-p2 to magento 2.4.0.
    i followed your instruction and
    After following command —
    (1)php bin/magento maintenance:enable
    (2)composer require magento/product-community-edition=2.4.0 –no-update
    (3)composer update

    I’ll get this type of error
    [ErrorException]
    “continue” targeting switch is equivalent to “break”. Did you mean to use ”
    continue 2″?
    please help..

  • Satish Patel

    I have followed your instruction to upgrade the Magento version but I faced an error. Any kind of help will be appreciable.
    I have installed Magento version 2.3.5-p1 and my PHP version was 7.2.33.
    So, first of all, I upgrade the PHP version to 7.4.9. Then after I run the command: composer require magento/composer-root-update-plugin=~1.0 –no-update. After that when i run composer update command it throws below error.

    Problem 1
    – magento/magento2-functional-testing-framework 2.5.3 requires php 7.0.2||7.0.4||~7.0.6||~7.1.0||~7.2.0||~7.3.0 -> your PHP version (7.4.9) does not satisfy that requirement.
    – magento/magento2-functional-testing-framework 2.5.3 requires php 7.0.2||7.0.4||~7.0.6||~7.1.0||~7.2.0||~7.3.0 -> your PHP version (7.4.9) does not satisfy that requirement.
    – Installation request for magento/magento2-functional-testing-framework 2.5.3 -> satisfiable by magento/magento2-functional-testing-framework[2.5.3].

    • Chirag

      Please set “magento/magento2-functional-testing-framework”: “2.4.5” in composer.json and do composer install

    • Nidhi

      Hello Satish,

      Were you able to resolve the issue as I am getting the same.

  • Chirag

    You have to contact server provider to install latest elastic search on your server.

  • RAKESH GUPTA

    I followed your instructions but VPs Server with CPanel, elasticsearch in not getting instaleld and started. When checked CPanel Documentation it says Elastisearch is not compatible with cPanel. How do I upgrade to v.2.4.0

  • All the comments are goes into moderation before approval. Irrelevant comment with links directly goes to spam. Your email address will not be published.

    Was this post helpful? Please support Us!

    Follow us on twitter or Like us on facebook.

     


    To Avoid Spam Downloads, We Want Your Email

    We will send you download link right
    away. Please submit form below.
    SEND ME DOWNLOAD LINK
    Close

    Increase Your
    Magento 2
    Knowledge

    Get Weekly Tutorial
    to your Inbox
    Subscribe Me
    close-link
    Subscribe Here