Categories: Magento 2 Tutorials

How to Update Magento 2 Using Composer

Disclaimer: Magenticians does not necessarily agree with the views expressed in this guest post. They are presented to bring to light all diverse views in the Magento and general ecommerce community.

Launched by Varien in 2007, Magento has now become one of the fastest growing ecommerce platforms. With a combination of several excellent and latest ecommerce features, it has crafted its worth in the modern ecommerce industry. And if you use the popular CMS and you’re wondering how to update Magento 2 using Composer, then we have you covered! Today, Magento is the primary choice as an ecommerce platform for more than 250,000 online stores because of its modular architecture, complete scalability, and the wide range of support and options. Discussions about the various issues people were facing while using Magento had started the day Magento 2 was released. But several experts came up with their exceptional opinions about the platform and made a huge impact on the Magento 2’s improvement. However, people still run into problems during its installation or get stuck in other procedures! Like other ecommerce platforms, Magento keeps coming up with updates to allow compatibility with industry trends and all users. This is why it is highly recommended that you always keep an up-to-date version of Magento.

Why Should You Update Magento 2?

One question, however, keeps rising: ‘Why should we update Magento 2?’ Here are 8 reasons why you really should:
  • Security Updates
  • UI Updates
  • Functionality Improvement
  • Bug Fixes
  • Performance Improvement
  • Support for the Latest Technology Stack
  • Catalog, Products, Shipping & Calculation Improvements
  • Integration Improvement with 3rd-Party Services like Google Analytics, Payment Methods, Gateways, etc.
There are several features in Magento 2 that we are familiar with. Magento 2 Command-Line Interface (CLI) is one of the best and saves a lot of time for developers in playing with module management, index management, cache management, and updating to the latest Magento 2 version, etc. Today, we are going to explain how to upgrade Magento 2 version using CLI. Keep in mind that you should create a backup of your store first because it’s not recommended to use this method on your live store. Also, you should know that Magento 2 CLI upgrade only works if you have installed your Magento 2 by using Composer or the archived ZIP file downloaded from the official Magento website. If you have cloned Magento 2 from GIT repository, this method won’t work for you.

Update Magento 2

So let’s dig into the upgrade procedure of Magento 2 by following these simple steps: Step 1 -> First of all, connect to your web server via SSH. Using putty or any SSH client, log in to your Magento 2 server with full file system ownership. Step 2 -> Once your SSH connection is established, you will need to navigate to your Magento 2 ROOT directory. Step 3 -> Now follow the order and use the following commands: composer require magento/product-community-edition 2.1.3 –no-update 2.1.3 is the latest version of Magento 2.1.x version. If you want to upgrade Magento 2.0.x version, change these numbers accordingly. composer update If an authentication prompted, enter your magento.repo authentication keys. rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* php bin/magento cache:clean php bin/magento cache:flush In case, if you are using cache storage other than Magento 2 filesystem (e.g. Varnish, Redis, Memcached, etc.), you will need to manually clear that cache too. php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento indexer:reindex Step 4 -> Now go to your Magento 2 Admin Panel and at the bottom right corner, verify that you have successfully updated your Magento 2 version. If any error displays, try resetting your file permissions and clear the cache again.

Conclusion

There are multiple ways to update Magento 2. In the above method, we have used Magento 2 CLI to perform this task. It’s a precise and useful guide to upgrade Magento 2 using Composer quickly. Feel free to leave me a message or email me anytime if you face any issue and need some extra help.
Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. He contributes as a Guest Author at Magenticians to share his knowledge with the Magento Community. Fayyaz is a food lover and enjoys driving.

View Comments

  • Hi,
    Maybe you are missing something, please follow all the steps again. On which command are you getting this error?

  • Please use the following command to update:

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

    The reason you are getting is error is because you are using a single "-" before "no-update"

    It should be like "--no-update"

    Hope this solves the matter, thanks!

  • This was soooo easy to follow! Thank you so much! I wish I saw this article before. I literally spent days doing it through the Web Setup Wizard.

  • Exception #0 (MagentoFrameworkExceptionLocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
    The following modules are outdated:

    All modules are outdated after upgrading amegtno2 version.

    upgradingt to : "magento/product-enterprise-edition": "2.1.8",
    Anybody can suggest me

Share
Published by
Fayyaz Khattak

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

11 months ago