Upgrading Magento 2.2 to 2.3 – Easy step by step instructions

Step one: 

Before we do anything – go ahead and backup your store, we’ll need to backup the codebase and the database, this should be a smooth upgrade but you never know (it is Magento afterall…) You’ll be thankful that you can revert back to a working version of your magento store easily if something goes wrong during the upgrade process. Backing up your store for things like this is important, don’t underestimate this step!

You can do this via the Magento CLI, or for peace of mind you may prefer exporting the database manually.

We’ll assume you’re using a sane way of versioning and maintaining your magento stores codebase, like GIT or SVN. We’ll be using GIT so we can create a new branch and use this branch to perform the upgrade from Magento 2.2 to Magento 2.3 and test it before merging it back in to your master branch. Ensure your composer.json  is backed up too in your repository.

Step two:

With our magento store safely backed up, we can go ahead and begin the upgrade process. It’s relatively easy in Magento 2 as majority of it is handled by updating your composer file. This is done usually via the command line. Run the following commands to kickstart the upgrade process.

This will add the new Magento 2.3 dependencies to your composer file:

composer require magento/product-community-edition=2.3.0 --no-update

This will add third party dependencies that the new 2.3 system uses:

composer require --dev phpunit/phpunit:~6.2.0 friendsofphp/php-cs-fixer:~2.10.1 lusitanian/oauth:~0.8.10 pdepend/pdepend:2.5.2 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:3.2.2 --no-update

This will remove some third party dependencies that are no longer used:

composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update

Now open the  composer.json  file and add  Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/  into the “psr-4” section.

The psr-4 section in your composer file should now look like the following:

"autoload": {
    "psr-4": {
        "Magento\\Framework\\": "lib/internal/Magento/Framework/",
        "Magento\\Setup\\": "setup/src/Magento/Setup/",
        "Magento\\": "app/code/Magento/",
        "Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"

And finally, you’ll want to change the “version” attribute in your composer.json  file to  2.3.0, this step is more for you and your developer friends sanity the next time you open this composer file, they wont be confused by wrong version numbers.

… Now for the moment of truth, to tell composer to install and update the new dependencies, we run on the command line:

composer update

Once that’s complete, you’ll want to remove the var caches and generated directories. If you use Redis or Memcached, you’ll want to flush the cache for these.

rm -rf var/cache/*

rm -rf var/page_cache/*

rm -rf generated/code/*

Finally, kickoff the install and upgrade scripts using:

php bin/magento setup:upgrade

Step three:

Congratulations! Your store should be now updated to Magento 2.3.

If you visit your website and you get a PHP syntax error that looks like “syntax error, unexpected ‘?’, expecting variable (T_VARIABLE) ” or  a 500 error, try checking/switching your PHP version to 7.1.3+, this is a new requirement for Magento 2.3. If you was running Magento 2.2 on PHP 7.0.13 this might be a common issue with the upgrade.

However an often overlooked step is to check any third party or custom extensions that you’ve installed don’t have any deprecated/breaking code changes in them. This upgrade is quite tame and doesn’t seam to have many breaking changes, but be sure to check out the official Magento 2.3 breaking changes list here.

If you get an issue with composer and an error that includes  requires composer-plugin-api ^1.1 – try updating your composer using  composer self-update as it may just be a little out of date.





Ready to start your next project?

See how we can help you accelerate your business