Magento 2 Upgrade Recommendations
The following are helpful guides for upgrading Magento 2.x.
Support for upgrading Magento 2 is outside of our support policy scope. However, we can help with a backup restore if something goes wrong.
Before Upgrading
Perform a local backup of the files and database before upgrading. Test the upgrade first on a development instance before performing the same steps on production.
- Disable crons temporarily
- Put the site in maintenance mode
Upgrading to a Major Release
To upgrade to 2.2.7 (in this example), run:
composer require magento/product-community-edition 2.2.7 --no-update
php -d memory_limit=4096M /usr/local/bin/composer update
php -d memory_limit=4096M /usr/local/bin/composer -v install
php -d memory_limit=4096M bin/magento setup:upgrade
php -d memory_limit=4096M bin/magento setup:di:compile
php -d memory_limit=4096M bin/magento setup:static-content:deploy
For more information, see Magento's upgrade documentation.
Upgrading to 2.3.x Using the Magento script
wget https://raw.githubusercontent.com/magento/magento2/2.3/dev/tools/UpgradeScripts/pre_composer_update_2.3.php
php -f pre_composer_update_2.3.php -- --root=/srv/public_html --repo=https://repo.magento.com/ --version=2.3.3
php -d memory_limit=4096M /usr/local/bin/composer update
php -d memory_limit=8000M bin/magento setup:upgrade
php -d memory_limit=4096M bin/magento setup:di:compile
php -d memory_limit=4096M bin/magento setup:static-content:deploy
For more information, please see Magento's upgrade documentation.
If you receive an error about Magento credentials, run
composer update
. This will prompt you for your credentials. Choose "Y" to save them to your project.
Upgrading from 2.3.x to 2.4.x
- Ask MageMojo Support to upgrade MySQL to a minimum of version 5.7.
- Enable Elasticsearch 7 in the STRATUS panel (it will redeploy upon change)
- Confirm that PHP is version 7.3+ (it will also redeploy upon change)
php -d memory_limit=4096M /usr/local/bin/composer require magento/composer-root-update-plugin=~1.0 --no-update php -d memory_limit=8000M /usr/local/bin/composer update php -d memory_limit=4096M /usr/local/bin/composer require magento/product-community-edition=2.4.0 --no-update --interactive-magento-conflicts php -d memory_limit=8000M /usr/local/bin/composer update php -d memory_limit=4096M bin/magento setup:upgrade php -d memory_limit=4096M bin/magento setup:di:compile php -d memory_limit=4096M bin/magento setup:static-content:deploy
After Upgrading
- Re-enable crons.
- Take the site out of maintenance mode.
- Clear all caches
- Perform an autoscaling reinit or ZDD commands if Zero Downtime Deployment is enabled.