How and Why to Update Magento 2
Keeping a CMS platform up to date is very important, for several reasons:
- Platform vulnerabilities;
- platform performance;
- Improvements and new features;
- General code fixes;
- Changes in the application stack.
Magento is constantly being updated, and as time goes by older versions are no longer supported by the community. Sometimes even by the hosting providers themselves, who have to decommission servers that are too old to make room for servers with more up-to-date stacks.
Moreover, the plugins installed on the platform release new versions with new or improved features, but these may not be compatible with older versions of Magento.
How do you update Magento?
The first thing to look at is which version we are starting from and which version we want to reach, because first of all we need to update the application stack, following the table at this link.
At this point we need to check the version of “magento/composer-root-update-plugin” in our composer. For the command shown below, we need to have version 2; if version 1 is installed instead, we need to update it:
composer remove magento/composer-root-update-plugin --no-update
composer require magento/composer-root-update-plugin:2.0 --no-updateOnce the application stack has been updated, the commands to run are the following, where 2.4.6-p4 is the latest stable version currently available:
composer require-commerce magento/product-community-edition:2.4.6-p4 --no-update
composer updateAfterwards, a full deploy is of course mandatory.