How To Upgrade Magento 2 To Latest Version
In this article, I will explain how to upgrade your Magento version from Magento 2.x.x to Magento 2.x.x using Command-Line Interface (CLI). We'll recommend you to apply upgrade in your staging site and test everything before you apply this method on your live store.
Step 1: Access Your Server via SSH
You need to connect your server via SSH.
Step 2: Navigate to the Magento 2 Root Directory
Once your SSH connection is up, you will need to move to your target application folder. In that application folder, you will find the public_html folder which is the root directory of Magento 2.
Step 3: Upgrade Commands
Please follow the same order and use the commands listed below:
composer require magento/product-community-edition 2.4.5 --no-update
If you are using Adobe commerce cloud and want to update version the you need to run the below command.
composer require "magento/magento-cloud-metapackage":">=2.4.5 <2.4.6" --no-update
Note: As 2.4.5 is the latest version, these numbers can be changed accordingly. You can also Upgrade Magento 2.x.x to 2.x.x using the same process. you just need to change the version 2.x.x.
If you are getting any error-related platform requirements then run the below command.
composer update --ignore-platform-reqs
Note: It will ask for repo.magento.com authentication keys. For more information, visit this link.
rm -rf var/di var/generation php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:clean php bin/magento cache:flush php bin/magento indexer:reindex
This website is not responsible for any damage. So, you can apply this at your own risk.
I hope this Magento blog helped you find what you were looking for.
Bookmark it for your future reference. Do comment below if you have any other handy commands which are not included in the list.
P.S. Do share this note with your team.
Review other articles maybe it'll help you too.