Upgrading the Magento version for any particular environment in Magento Cloud could vary depending on the version to be installed and other running Magento services.
Before the upgrade please check the recommended configuration for the specific Magento version to be installed; by doing this, you would reduce the redeployment time and decrease any risk of unexpected installation errors.
You can check here and here for more information on how to select the correct configuration for your environment.
Upgrading the Magento version is as follows:
- By using CLI, change to your local Magento root directory and set the upgrade version using the version constraint syntax:
composer require “magento/magento-cloud-metapackage”:”>=CURRENT_VERSION <NEXT_VERSION” –no-update
For example, when upgrading from version 2.3.7 to version 2.3.8, the execution should as follows:
composer require “magento/magento-cloud-metapackage”:”>=2.3.7 <2.3.8″ –no-update
- Manually edit the composer.json file for modifying the PHPUnit accordingly with the PHP version, just as indicated in the following table
PHPUnit version | PHP version |
9 | >= 7.3 |
8 | >= 7.2 |
7 | 7.1 ~ 7.4 |
6 | 7.0 ~ 7.2 |
In case you are not performing unit or integration tests you might just delete the entries on the require-dev section and leave all blank:
“require-dev”: {
},
- For avoiding conflicts with previous packages you might need to remove the composer.lock file for forcing regeneration of this file:
- Update the project.
composer update –with dependencies |
- Add, commit, and push code changes.
git add -A
git commit -m “Upgrade Magento version”
git push origin <branch-name>
- Wait for deployment to complete.
- Verify the upgrade in the environment by using SSH to log in and check the version.
php bin/magento –version |
After verifying the Magento version, the environment is ready to be used. Also, do not forget to create backups of your database, code, and media files before upgrading the Magento version in the environment.