As the title indicates, this article will guide you about Magento 2 update using the command line interface (CLI) method. Before we go further, we would like to mention that there are 3 ways to upgrade Magento 2. However, for the sake of this article, we will only focus on one particular method in this article – the CLI method. You can use this method if you have installed the Magento software by:
If you are still running on Magento 1, you’ll first need to upgrade to Magento 2 before you can even think of installing any Magento 2 update.
There are countless reasons to upgrade Magento 2 to the latest version, 2.4.7.
With almost each new update, the developers introduce security features that are critical for your store’s protection. Given the rising instances of online crime nowadays, relying on outdated technology is a recipe for disaster. Hackers may exploit a vulnerability in the older version and wreak havoc across your store. Once your reputation is lost, it can be quite challenging to recover it.
Another reason to upgrade Magento 2 is because of the new features. While they may not seem much, in reality, they can go a long way in enhancing user experience and overall store operations. For instance, the latest version brings support for PHP 8.3.
Additionally, the developers keep optimising their code which results in performance improvements.
Magento just introduced a patch on June 11 2024. For more information on it, visit here. If you read carefully, you’ll notice that the patch offers fixes for a few security bugs and issues related to UPS. If a user fails to upgrade to the latest version, they’ll be running their store with known security vulnerabilities and other bugs.
To make sure the process goes smoothly, do the following before you start the upgrade.
bin/magento maintenance:enable
This is a frequent question from store owners who have used a lot of custom code in their Magento 2 store. As long as you haven’t made the customisations to the core Magento 2 files, then your extensions will work smoothly even after the update. The reason is that any Magento extension company assumes that the core files are untouched. In case changes are done to the core files, updating Magento will overwrite the core files, doing away with all the custom code.
Follow the steps below to upgrade your Magento 2 via CLI.
You need to login to your Magento server using your SSH credentials.
Once you are connected, navigate to your Magento 2 root directory. Usually, it is public_html.
Apply the following commands to upgrade.
composer require magento/product-community-edition=2.3.3 --no-update composer update
Version 2.7.7 is the latest version. You can change this number accordingly.
Step 4: Enter your Authentication Keys
It will ask for authentication keys. If you don’t know how to find/generate authentication keys, click here.
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*
php bin/magento setup:upgrade
You are ready to make your store live again.
php bin/magento maintenance:disable
That’s all you needed to do. Now, open your storefront URL in a web browser and see if the upgrade was successful. Check your Magento 2 version to ensure that the update was successful.
Read More:This blog was created with FME's SEO-friendly blog