Magento 2’s latest release always focuses on enhancing security, improving performance, and fixing bugs. This blog can help you upgrade Magento 2.
Please check the system requirements for Magento 2 version
Note: It is recommended to take the code and database backup if you plan to upgrade your live site.
We will upgrade from Magento 2.3.5-p2 to Magento 2.4.7-p3 in the following steps.
Step 1: Change your composer version to the compatible version of the latest Magento 2 version.
composer -vvv about
Step 2: Take a backup of the composer.json
cp composer.json composer.json.bak
Step 3: Put your site into maintenance mode.
php bin/magento maintenance:enable
Step 4: Install the Composer update plugin
composer require magento/composer-root-update-plugin=~2.0 --no-update
Step 5: Update Magento version in composer.json file using below command. You can type the any required Magento version.
composer require magento/product-community-edition=2.4.7-p3 --no-update
Step 6: This step keeps you safe from the dependency version issues. You have to update “require-dev” key in root composer.json. You can see this in the magento composer.json file on github.
Check the Magento 2.4.7-p3 required compatible dependencies.
Here we are using the require-dev of Magento 2.4.7-p3.
"require-dev": { "allure-framework/allure-phpunit": "~1.5.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "friendsofphp/php-cs-fixer": "~3.3.0", "lusitanian/oauth": "~0.8.10", "magento/magento-coding-standard": "*", "magento/magento2-functional-testing-framework": "^3.7", "pdepend/pdepend": "~2.10.0", "phpmd/phpmd": "^2.9.1", "phpstan/phpstan": "~1.2.0", "phpunit/phpunit": "~9.5.0", "sebastian/phpcpd": "^6.0.3", "squizlabs/php_codesniffer": "~3.6.0", "symfony/finder": "^5.2" },
Step 7: Now change PHP version to the compatible version with Magento 2.4.7-p3.
sudo a2dismod php7.3 sudo a2enmod php8.2 sudo update-alternatives --set php /usr/bin/php8.2 sudo /etc/init.d/apache2 restart php --version
Step 8: Update dependencies using the following command.
composer update
Step 9: Execute the following commands.
rm -rf var/cache/* rm -rf var/page_cache/* rm -rf generated/code/* bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento c:f
Step 10: Check base url in core_config_data and update with adding pub/ after base URL.
For example https://devmage.com/m235p2 to https://devmage.com/m235p2/pub
php bin/magento c:f
Step 11: Disable the maintenance mode
php bin/magento maintenance:disable
Hope this helps, Thanks 🙂
If you require technical support, feel free to email us at [email protected].
Additionally, explore a wide array of solutions to boost your store’s capabilities by visiting the Adobe Commerce modules section.
For expert advice or to create tailored features, hire Adobe Commerce Developers for your project.
Be the first to comment.