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

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

Run the script

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

Apply updates

composer update

Clear caches and generated content

Clear the var and generated subdirectories:

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

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

bin/magento setup:upgrade

Disable maintenance mode

bin/magento maintenance:disable

Restart Varnish

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

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
    • <magento_root>/generated/metadata
  3. Check your storefront in your web browser again.