Upgrade using the Magento composer root plugin
The magento/composer-root-update-plugin
Composer plugin resolves changes that need to be made to the root project composer.json
file before updating to a new Magento product requirement.
Basically, this section repeats the manual upgrade scenario with the only exclusion that you are guided to install the plugin to resolve the dependency conflicts instead of fixing them manually.
Before you begin
Refer to Prerequisites.
If you need to upgrade PHP, do so before proceeding with the following steps.
Backup composer.json
Backup the existing composer.json
file in the Magento installation directory.
Install the plugin
1
composer require magento/composer-root-update-plugin=~1.0 --no-update
Update the dependencies:
1
composer update
Manage packages
Specify needed packages and remove any unneeded ones before proceeding with the upgrade.
Deactivate the Magento Open Source update (for edition upgrade only)
Optional—If you are upgrading from Magento Open Source to Magento Commerce, deactivate the Magento Open Source update:
1
composer remove magento/product-community-edition --no-update
Specify Magento packages
Indicate the Magento packages, both the edition (community
or enterprise
) and the version (2.3.2
), that you want to upgrade to.
The first time you upgrade using the plugin, you can interactively view and update any out-of-date values that may be remaining from previous versions.
To enable this, use the --interactive-magento-conflicts
option on the composer require
commands.
Use composer require --help
to learn more about available options.
To learn more about usage of the plugin, refer to the Plugin Usage.
Magento Open Source:
1
composer require magento/product-community-edition=2.3.2 --no-update
Magento Commerce:
1
composer require magento/product-enterprise-edition=2.3.2 --no-update
To see a full list of available 2.3 versions:
Magento Open Source:
1
composer show magento/product-community-edition 2.3.* --all | grep -m 1 versions
Magento Commerce:
1
composer show magento/product-enterprise-edition 2.3.* --all | grep -m 1 versions
Modify the Magento updater
Optional—If the Magento updater is installed (it is located in update/
) modify it:
- Backup
update/
directory. -
Create a Composer project.
Magento Open Source version 2.3.2:
1
composer create-project --repository=https://repo.magento.com magento/project-community-edition=2.3.2 temp_dir --no-install
Magento Commerce version 2.3.2:
1
composer create-project --repository=https://repo.magento.com magento/project-enterprise-edition=2.3.2 temp_dir --no-install
If you need to use a repository that contains non-public packages, such as internal sandboxes, change the URL in
--repository
accordingly. -
Remove the old
update/
directory and move thetemp_dir/update/
to theupdate/
directory:1
rm -rf update
1
mv temp_dir/update .
1
rm -rf temp_dir
Update metadata
Updating the metadata in the composer.json
file is entirely superficial, not functional.
Update the "name"
, "version"
, and "description"
fields in the composer.json
file as needed.
Apply updates
1
composer update
Clean the Magento cache
After applying an update, you must clean the cache.
1
bin/magento cache:clean
Manually clear caches and generated content
Clear the var/
and generated/
subdirectories:
1
rm -rf var/cache/*
1
rm -rf var/page_cache/*
1
rm -rf generated/code/*
If you use cache storage other than the filesystem, such as Redis or Memcached, you must manually clear the cache there too.
Update the database schema and data
1
bin/magento setup:upgrade
Disable maintenance mode
1
bin/magento maintenance:disable
Restart Varnish
Optional—If you use Varnish for page caching, restart it:
1
service varnish restart
Check your work
Open your storefront URL in a web browser to check whether the upgrade was successful. If your upgrade was unsuccessful, your storefront will not load properly.
If the application fails with a We're sorry, an error has occurred while generating this email.
error:
- Reset file system ownership and permissions as a user with
root
privileges. - Clear these directories:
var/cache
var/page_cache
generated/code
- Check your storefront in your web browser again.