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!
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.
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:
This will add third party dependencies that the new 2.3 system uses:
This will remove some third party dependencies that are no longer used:
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:
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:
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.
Finally, kickoff the install and upgrade scripts using:
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.