Which Way To Upgrade Magento 2 Would You Choose?

3-ways-to-upgrade-your-magento-2
Posted in: Magento 2 Guides

Staying up-to-date and keeping a high-security level are crucial to having a competitive e-commerce store. You shouldn't have the "why upgrade to Magento 2" question. This article will help you to update your Magento 2 store smoothly and quickly.

Sticking to the point, there are several ways to do it. Let’s review three of them one-by-one.

Before we start, remember that it is always wise to back up files before running a Magento upgrade.

Now, to the methods.

METHOD #1. USE MAGENTO COMPOSER

The first method is based on using Magento 2 Composer for upgrade and includes the following 8 steps.

Step 1. Logged in as a system owner (root user), navigate to the Magento 2 root folder cd ~ /public_html

Step 2. Switch to the Maintenance mode via the command php bin/magento maintenance:enable

Step 3. Clear everything in the vendor folder by running the command rm -rf vendor/*

Step 4. Open the composer.json file and change the current version of your Magento to the required one, as in the screenshot below:

Check Magento 2 version in the json file.

Alternatively, you can execute the Require command to request the Magento 2 package to use Composer and update associated files:

composer require <product> <version> —no-update

composer update

Say, you would like to upgrade to Magento 2 CE 2.4.5. Then use the command as in the example:

composer require magento/product-community-edition 2.4.5 —no-update

composer update

In the same way, you can use Composer to upgrade Magento to any version you need, for example, perform Magento upgrade from 2.4.4 to 2.4.5.

Step 5. Specify access keys if needed. You can get them using the following link. This is what you will see after you log in:

magento 2 access keys

 Username corresponds to the public key and password corresponds to the private key.

After you enter keys, the installation of files will begin.

Step 6. When the installation is complete, you need to clear var child directories. For this, execute the commands below:

rm -rf <Magento install dir>/var/cache/*

rm -rf <Magento install dir>/var/page_cache/*

rm -rf <Magento install dir>/var/generation/*

If you use Varnish, Redis, Memcache, or another caching option, remember to flush them as well.

Step 7. After clearing subdirectories, use another query to upgrade the database schema:

php bin/magento setup:upgrade

Step 8. Disable the Maintenance mode and put your store back to work by running the command:

php bin/magento maintenance:disable

METHOD #2. UPGRADE VIA MAGENTO 2 SETUP WIZARD

The second method is easier and suits those who are not that good at using Magento 2 Composer.

Step 1. Access your store admin side as a user with full permissions (super-admin).

Step 2. Navigate to System > Tools > Web Setup Wizard. You will see the following menu:

Access the Magento 2 setup wizard.

Step 3. Select the System Configuration option.

You may be asked to specify authentication keys in the corresponding fields. Again, you can get the keys on Magento Marketplace (see the link above).

Step 4. Click Save config and then System Upgrades.

During the upgrade process, you will get detailed instructions so there shouldn`t be any issues. Note that, at the Readiness check process step, you may be asked to upgrade PHP since M2.3, and M2.4 support different PHP versions.

 To learn more about PHP support, check system requirements for M2.3, M2.4.

It is better to back up files manually and skip the backup step suggested by the wizard as it may fail and you`ll have to start the process once again.

METHOD #3. UPLOAD THE LATEST VERSION MANUALLY

This method is the simplest one, so even a Magento 2 newbie can manage it.

Step 1. First, to download the required version, go to the official Magento website. Put downloaded files to the Magento 2 root folder and unzip the package.

Step 2. If Magento asks to replace existing files, click ‘Yes’.

Then, in SSH console, run the following commands one by one.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php bin/magento indexer:reindex

 Make sure every command is complete before starting the next one.

The above will help you refresh the database schema, update all dependencies, and flush caches. If you have a lot of products, customers, orders, etc., you may need to wait some time until each command is executed.

The upgrade task is almost complete. Now you can check your store frontend and admin view to ensure that everything looks and works as expected. If you use third-party extensions, run some smoke tests to check that these modules are still compatible with your new Magento version and upgrade them as well if needed.

FINAL WORD

Today we learned how to upgrade a Magento 2 store to a later version by using three methods: via Magento Composer, via the Setup Wizard, and by uploading files manually. We can’t say that one of these methods is better than others. In the end, this is a matter of choice to opt for a particular way to upgrade.

If you need help upgrading your version of Magento, our experts will be glad to help you, click here.

July 4, 2018
July 9, 2018
June 26, 2018
Comments
Syed Muneeb Ul Hasan
July 16, 2018
I think users normally use method 1 "Command", even me :) Thanks for sharing this great tutorial.
Reply
Alina Bragina
July 19, 2018
Hi there, thanks for taking the time to leave your feedback! We are glad to share our experience and be helpful. Cheers!
Guest
September 10, 2019
5
Reply
Peter miller
December 16, 2019
Hi, Thank you for writing such an informative blog. I’m planning to upgrade to Magento 2 and this blog has taken away all my confusions and worries regarding the migration process. I had no idea there are several ways to so.
Reply
Polina Litreyeva
December 20, 2019
Hello! Thanks for sharing your opinion. If you need help, feel free to <a href="https://amasty.com/contacts/">contact us</a>.
Yogesh
March 6, 2020
Hi Team, I'm trying to update magento 2.2.1 to 2.2.11 with METHOD #3. UPLOAD THE LATEST VERSION MANUALLY but unfortunately, the result is nothing.
Reply
Polina Litreyeva
March 9, 2020
Hello, Yogesh! Thanks for the feedback! Pity, you have the issue. You can try to update your system with the first 2 methods, or check the <a href="https://devdocs.magento.com/guides/v2.3/comp-mgr/upgrader/upgrade-checklist.html" rel="nofollow">official Magento documentation</a> for more info. Unfortunately, we need to dive deeper into the system itself to understand why an error occurred. Sorry, but that is why we won’t help you in the comments. Cheers!
Yogesh
March 10, 2020
Hello, Polina Thank you for your update I have tried with the first method i.e METHOD #1. USE MAGENTO COMPOSER everything is working fine and version also updated but please check the below points why I'm getting while using COMPOSER UPDATE command Package zendframework/zend-text is abandoned, you should avoid using it. Use laminas/laminas-text instead. Package zendframework/zend-uri is abandoned, you should avoid using it. Use laminas/laminas-uri instead. Package zendframework/zend-validator is abandoned, you should avoid using it. Use laminas/laminas-validator instead. Package zendframework/zend-view is abandoned, you should avoid using it. Use laminas/laminas-view instead.
Polina Litreyeva
March 13, 2020
Hi, Yogesh! Laminas is a new name of the Zend Framework. It seems like you got these notifications because you need to migrate to Laminas-branded packages. For more info, please check the<a href="https://www.zend.com/blog/evolution-zend-framework-laminas-project" rel="nofollow"> official Zend Framework explanation</a>. Cheers!
Me
February 15, 2021
Hi, I have read your guide: https://amasty.com/blog/3-ways-to-upgrade-your-magento-2/ Why do I need to do this command at step 3? rm -rf vendor/* In the vendor directory there are all kinds of extensions which would be removed. I can not see anywhere in your guide that these are being reinstalled. When doing the upgrade via download/copy/paste the vendor files get untouched which would make more sense to me.
Reply
Vladimir Derachits
February 22, 2021
Hi there, thanks for the feedback. You see it’s difficult to answer from here. Please, check out the <a href="https://devdocs.magento.com/guides/v2.4/install-gde/composer.html" rel="nofollow">official magento installation guide</a> to get more deatials about the installation process.
Steve ways
June 25, 2021
Magento is one of the best E-commerce platforms built on open-source technology. Thanks for sharing the informative article.
Reply
Vladimir Derachits
July 6, 2021
Hi Steve, thanks for your feedback! We are glad to share our experience and be helpful.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro

© 2009-2023 Amasty. All Rights Reserved.