Recently Magento has released Magento 2.4, and in some cases, you will want to update the new version of Magento to serve your personal or work purposes. Therefore, this article will show you how to upgrade the version in Magento 2 from 2.3 to 2.4.
How to upgrade Magento 2
First, make sure you’ve configured your server to work with PHP 7.4. According to the release notes of Magento 2.4, it only supports PHP 7.4, you can also install Magento 2.4 using PHP 7.3 but there is a risk. Ideally, you should use PHP 7.4. Also, you need to install Composer.
First, check your php version by running command:
Step 1: Switch the website to maintenance mode with the command below if your website is up and running.
php bin/magento maintenance:enable
Step 2: Get composer.json backup using the below command.
cp composer.json composer.json.bak
Step 3: Install Composer update plugin
composer require magento/composer-root-update-plugin=~1.0 --no-update composer update
Step 4: Once the Magento 2.4.0 version has been downloaded, go to the Magento 2 installation root path and run the command:
composer require magento/product-community-edition=2.4.0 --no-update
Step 5: Run the command
Step 6: Clear the cache and regenerate the code by running the following commands one by one:
php bin/magento cache:clean rm -rf var/cache/* rm -rf var/page_cache/* rm -rf generated/code/* php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f
Please note that if you turn on the maintenance mode as step 1, turn it off after Magento is downloaded.
php bin/magento maintenance:disable
Hope this guide helps you!