How to upgrade Magento 2 to a newer version and install latest security patches
How to upgrade Magento 2 to a newer version and install latest security patches
Note: Make sure to back up your store and database before performing a Magento upgrade.
Note 2: Backup your .htaccess file, as it will be overwritten when you upgrade.
Step 1: Run upgrade commands via SSH
Connect to your server via SSH and run the following commands from the root of your Magento installation:
php bin/magento deploy:mode:set developer
composer require magento/product-community-edition 2.2.5 --no-update
composer update
rm -Rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/ var/di;
php bin/magento setup:upgrade
Step 2: Restore your .htaccess file
After the upgrade, restore your .htaccess file from the backup you created earlier.
For more details about the upgrade process, please refer to the Official Magento 2 Documentation.
Updated on: 18/09/2025
Thank you!
