Upgrade using the custom script

Upgrading your Magento installation with our script, which makes the upgrade process semi-automated, is the preferred method.

Use the manual process if you previously made updates to the same values that the upgrade script affects, because the script will override those values.

The upgrade script:

  • Updates Magento with the 2.3 requirements.
  • Backs up the composer.json file.
  • Specifies the new version of the Magento metapackage.
  • Updates the "require-dev" section in the composer.json file.
  • Adds "Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/" to the "autoload":"psr-4" section in the composer.json file.
  • Backs up and updates the magento/updater, if it has been installed.
  • Updates the "name", "version", and "description" fields in the composer.json file.

Before you begin

Refer to Prerequisites.

If you need to upgrade PHP, do it before you run the script.

Download the script

Download, or copy, the script file from the magento/magento2 repo, /dev/tools/UpgradeScripts/pre_composer_update_2.3.php.

Show script options

1
php -f pre_composer_update_2.3.php -- --help

Run the script

1
php -f pre_composer_update_2.3.php -- --root='<path/to/magento/install/dir>' --repo=https://repo.magento.com/ <options>

Apply updates

1
composer update

Clear caches and generated content

Clear the var and generated subdirectories:

1
rm -rf <Magento install dir>/var/cache/*
1
rm -rf <Magento install dir>/var/page_cache/*
1
rm -rf <Magento install dir>/generated/code/*

If you use cache storage other than the filesystem, such as Redis or Memcached, you must manually clear the cache there too.

Update the database schema and data

1
bin/magento setup:upgrade

Disable maintenance mode

1
bin/magento maintenance:disable

Restart Varnish

Optional—If you use Varnish for page caching, restart it:

1
service varnish restart

Check your work

Open your storefront URL in a web browser to check whether the upgrade was successful. If your upgrade was unsuccessful, your storefront will not load properly.

If the application fails with a We're sorry, an error has occurred while generating this email. error:

  1. Reset file system ownership and permissions as a user with root privileges.
  2. Clear these directories:
    • <magento_root>/var/cache
    • <magento_root>/var/page_cache
    • <magento_root>/generated/code
  3. Check your storefront in your web browser again.