Magento 2 upgrade: Simple methods to implement it successfully

Magento 2 has released different versions with better security as well as other features. Therefore, Magento 2 update is essential. In this guideline, we will show you 3 ways to upgrade to Magento 2 successfully.

Using Magento composer

Let’s come to the first method of Magento 2 upgrade. In this method, you’ll use composer to do this. Composer is a dependency manager for PHP. With it, you can easily upgrade your Magento easily. Here’s how to do it

  • First, log in as a system owner, or root user. Then, navigate to the Magento root folder cd ~ /public_html
  • Now, through the command  php bin/magento maintenance:enable, switch to the Maintainance mode
  • Running the command rm -rf vendor/* to clear everything in the vendor folder
  • Then, you can open the composer.json file and change the current Magento version to the required one. 
Magento 2 upgrade

On the other hand, in case you want to use Composer and update associated files, you can use Require command to do this.

composer require <product> <version> —no-update

composer update

For example, you want to update to Magento 2 CE 2.2.4. Then, the command will be as follow

composer require magento/product-community-edition 2.2.4 —no-update

composer update

  • The next step of this Magento 2 upgrade method is specifying keys ( if needed). Firstly, go to the following link. After logging in, you’ll see the following
Magento 2 upgrade

Then, you’ll get the private keys. Once finish entering the keys, the installation of files will begin

  • Once you complete the installation, it’s time to clear var child directories. To do this, run the following command

rm -rf <Magento install dir>/var/cache/*

rm -rf <Magento install dir>/var/page_cache/*

rm -rf <Magento install dir>/var/generation/*

In case you use Varnish, Redis, Memcache or other catching options, don’t forget to flush them.

  • After that, use another query to upgrade the database schema

php bin/magento setup:upgrade

  • And finally, disable the Maintenance mode and get your store back to work. You can use the following command

php bin/magento maintenance:disable

Using the setup wizard in the Magento admin side

Moving to the second method of Magento 2 upgrade –  using the setup wizard. Compared to the previous method, using the setup wizard might be easier, especially for those who are not good at Magento 2 Composer. Here’s the steps of this method

  • First of all, go to your store admin side. Remember to access as a user with full permissions, or super – admin
  • Go to System >> Tools >> Web Setup Wizard. Then, you’ll see the following
  • Now, choose System Configuration. After this, you might have to specify the authentication keys. Then, you can go to this link to get the key on Magento Marketplace
  • Then, choose Save Config and then, select System Upgrade

One of the reasons why this Magento 2 upgrade method is quite simple is that you’ll get the instruction during the process. Therefore, you hardly meet any problems or unexpected issues. However, you should skip the wizard’s backup step. Once it fails, you’ll have to start the process all over again. As that said, you should back up files manually

Upgrade Magento 2 manually

Come to the final method of Magento 2 upgrade. With this method, you simply download the latest version and copy/ paste it. Out of all these 3 methods, this might be the simplest one

  • First, download the version you want by going to the official Magento Website. Once you finish downloading, put the files to the Magento 2 root folder and unzip the package
  • If you see the pop up asking “ Do you want to replace the existing file?”, choose “ Yes”
  • After that in SSH Console, run the following command one by one. 

First, run php bin/magento setup:upgrade

Then, php bin/magento setup:static-content:deploy

After that, php bin/magento cache:clean

And finally, php bin/magento indexer:reindex

  • Remember that you must complete every command before running the next one

If you have a lot of products, you might have to wait some time for every command to be executed.

Some problems during the upgrade process

During the process, you might encounter some issues and problems. Then, here are some common issues during the upgrade and how to fix them

Component dependency conflict

You might meet this problem when upgrading via Setup Wizard. Moreover, this Magento 2 upgrade error often occurs at the Readiness Check step. You’ll see the following


Most of the time, this error happens due to a third – party extension depending on old Magento 2 components. Then, to fix this, you can follow these steps. 

  • Firstly, uninstall all custom extensions
  • After that, perform Magento 2 upgrade as normal
  • Once you finish updating, you can reinstall the extension
Can’t create directory

If you run php bin/magento setup:upgrade right after upgrading, you might encounter this problem. Here’s how the issue description will look like

Fixing this error is quite simple. Firstly, you delete var/di folder. After that, change the permissions of var and pub folder to 777, or chmod -R777 var pub. After that, run php bin/magento setup:upgrade. then php bin/magento setup:di:compile.

Can’t allocate memory error

This error happens when there is not enough RAM allocated for PHP processes. To resolve this problem, contact your system administrators and ask them to increase the memory limit. Ideally, you should increase memory limit to at least 2Gs.

No commands defined in the setup namespace

There are many ways to fix this error, here are some of them

  • Give full permission to var and pub folder
sudo chmod -R 777 var pub
  • Check your custom modules carefully. Make sure every extension’s module.xml has setup_version in it
  • Check your composer.json file to see if there is any error
Php bin/magento setup: upgrade not working

The reason for this error might be some problems in the custom module. Therefore, to fix this issue, check each one to see if there is any problem. Another way to fix this is deleting all custom modules, update your instance and reinstall them

Check here to learn how to fix common Magento 2 upgrade errors

In conclusion

Now, you might have some understanding about Magento 2 upgrade and know how to execute it successfully. However, it’s an undeniable fact that Magento is not an easy platform to use. Therefore, to get the best out of Magento, you’d better have some help from experts or professional developers. In this case, we highly recommend ArrowHitech

ArrowHitech is a leading IT outsourcing company in Vietnam. We have more than 14 years of experience working on different projects, including Magento Development: Migration & Upgrade service. Working with our decade – long experienced developers, you’ll surely get all your requirements met. Contact us here