Data Driven Design icon

Upgrade from Magento 2.2.x to 2.3.0

Upgrading Magento from 2.2.x to 2.3.0 can be a bit intimidating if you haven't upgraded a Magento install before but it is a fairly painless process if you follow the right steps. Unfortunately the official Magento site doesn't give a clear step-by-step guide on how to do this so you are left hunting the internet to find a good walk through. In this guide we will give you a clear, easy to follow, guide on how to upgrade Magento 2.2.x to 2.3.0.

The first thing you need to do with any upgrade or major change on a site is take a backup. The steps involved depend on how you host and manage your install. We will walk through a couple common ways to do this.


Backup from Magento 2 Admin

Taking a backup directly out of the Magento 2 admin is very straightforward and will work on any Magento 2 installation. Backups are stored in var/backups so make sure that the user Magento 2 is running as on your server has write permissions to create the files inside of that directory or the backup will fail. For detailed steps read the Magento developer documentation on how to take a backup from the admin panel.

Backup from the Magento 2 CLI

If you prefer to use the CLI, you can also take backups from the Magento CLI. This functionality mirrors the backups from the admin interface but can be scripted if you need to run a bunch of upgrades on your own or client sites. For detailed documentation read the Magento developer documentation on how to take a backup from the Magento 2 CLI.

Take a Server Snapshot on Digital Ocean

If you host your Magento application on Digital Ocean, you can just take a quick snapshot of the droplet so you can quickly restore the entire droplet to it's initial state if anything goes wrong. This works great since, as part of the upgrade process you will in many cases need to upgrade PHP which a backup from Magento wont allow you to rollback from. You can read more about taking a Digital Ocean snapshot in their very detailed snapshots walk through.

Create a Staging Instance on Cloudways

Cloudways is our preferred host for Magento 2 applications and creating a staging instance with the click of a button is just one of the many reasons. This will allow you to mirror your Magento 2 application onto a new staging instance where you can perform the upgrade. If all goes well, you push the changes to the production environment. If not, you can just destroy the staging environment and try again. I would highly reccomend that you look into hosting on Cloudways if you haven't taken a look at it before. For detailed instructions on creating a staging environment, ready their developer documentation on creating staging environments from live sites.

Upgrading PHP

Upgrading PHP to PHP 7.2 or PHP7.1.3+ is a requirement of going from Magento 2.2.x to 2.3. Depending on how you host your site, this can take many forms. There are tons of guides out there on this for Ubuntu, RHEL, Fedora, etc. so we will not re-invent the wheel here. If you are on Cloudways like we are, this is a simple button click. Here is a step by step guide of the PHP 7.x upgrade process.

Upgrade Magento from 2.2.x to 2.3.0

After ensuring that you have a backup and upgrading to a supported PHP version, you are only a few steps away from being done and they all take place in the Magento 2 CLI.

S
tep 1

Navigate to the root of your Magento 2 installation (where composer.json lives) and run the following:

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

Next we need to use composer to pull in the additional required PHP packages that are need for the upgrade. To do that, run the following:

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
S
tep 3

Now let's remove the un-needed packages using composer so we have a nice, clean Magento 2 installation:

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

This step is a bit weird and is probably part of why there isn't an official guide on this process. You need to manually update your composer.json file to include an additional resources in the autoload definition. To do that use your text editor of choice (we like VI but you can use Nano or something else if you prefer). Around line 47 of the composer.json file you will find the autoload PSR-4 definitions. You will need to add Zend\\Mvc\\Controller\\”: “setup/src/Zend/Mvc/Controller/ to the definition. It should look something like this when you are done:

"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/"
    },
    ...
}
S
tep 5

Finally, all the pieces are in place and we are ready to install the update. This command will take quite a while to complete. It is going to download all the required packages and install the new version of Magento.

composer update
S
tep 6

Once the install has completed you need to run the upgrade process to update the database to the 2.3.0 version, re-compile, deploy the sites static and clear your caches.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

If all went well, you are now on Magento 2.3.0. You should see the new version number listed in the footer of Magento's admin panel and get the notification of the new features when you login to the admin section for the first time. If you run into any issues during the upgrade, leave me a comment below and I will try to help you troubleshoot the problem.

Get In Touch.
Contact