How to Upgrade Magento Version from 2.2.x to 2.3.0?

After a long wait, Magento version 2.3.0 is finally available for the community. You can download Magento version 2.3.0 from the official Magento Website. Many developers have already started upgrading their stores. However, some of the developers are looking for step by step guide on how to upgrade Magento version from 2.2.x to 2.3.0. In this article we, will show you step by step how to upgrade Magento version from 2.2.x to 2.3.0 .

Preparing Your Site for Upgrade

First thing one should always do before upgrading is to backup Magento 2 site. You can take a Magento 2 site files and database backup using Magento 2 admin panel. Go to Magento 2 admin > System > Tools > Backups and take backup.

After that please upgrade your PHP version to PHP 7.2 or PHP 7.1.3+ as Magento 2.3 no more support PHP version lower than 7.1.3

Also please check the composer is pointing to the same PHP version by running below command.

composer -vvv about

Upgrade Magento version from 2.2.x to 2.3.0

After taking backup, follow below steps to upgrade your Magento 2 site version from 2.2.x to 2.3.0

Step 1: Update composer.json file. Navigate to your Magento 2 installation root path and run below command

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

Step 2: Run below command to add additional packages to composer.json file.

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

Step 3: Remove unused packages from composer.json file.

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

Step 4: Open composer.json file to add “Zend\\Mvc\\Controller\\”: “setup/src/Zend/Mvc/Controller/”: around line 47 under psr-4 section.

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

Step 5: Run below command

composer update

This command will take some time to finish and it will actually download all the required packages and upgrade your website. After this command finish, run below commands

Step 6: Clear cache and regenerate code.

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

That’s all. You have successfully upgrade your Magento version from 2.2.x to 2.3.0

Remember, One should always upgrade Magento 2 website to it’s latest version to make your store bug free. Hope this article will help you.

Getting error while upgrade? Please leave us a comment below.

Want to ask a question or leave a comment?

Leave a Comment

(15 Comments)

  • Artem

    Good afternoon!

    You can help me with this problem.
    I followed your instructions to update my Magento 2.2.9 to 2.3.4.
    In the last step, when I try to execute the last command (deploy content), I get the following error:

    In Abstract.php line 144:

    SQLSTATE[HY000] [2002] Connection refused

    In Abstract.php line 128:

    SQLSTATE[HY000] [2002] Connection refused

    • Chirag

      This error meaning your SQL connection lost while running command. Contact your hosting provider about this issue.

      • Artem

        Thanks! It helped a lot.

  • Sri

    Hi Alex,

    I have updated the magento version successfully, but while running upgrade command getting following error

    SQLSTATE[HY000]: General error: 1025 Error on rename of ‘./revel_wine/#sql-3be_71e’ to ‘./revel_wine/customer_group’ (errno: 150 – Foreign key constraint is incorrectly formed), query was: ALTER TABLE `customer_group` MODIFY COLUMN `customer_group_id` int(10) UNSIGNED NOT NULL AUTO_INCREMEN

    • Chirag

      Hi Sri,

      Please do this
      SET FOREIGN_KEY_CHECKS = 0;
      Truncate table customer_group
      SET FOREIGN_KEY_CHECKS = 1;

      please take a backup of customer_group before following the above steps.

  • Leonard

    Hello,

    When I try to upgrade I get this error:

    “`
    CONSTRAINT `CATALOG_PRODUCT_ENTITY_VARCHAR_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE), query was: ALTER TABLE `catalog_product_entity_varchar` MODIFY COLUMN `entity_id` int(10) UNSIGNED NOT NULL DEFAULT 0 , MODIFY COLUMN `value` varchar(255) NULL COMMENT “Value”, ADD CONSTRAINT `CAT_PRD_ENTT_VCHR_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE, ADD CONSTRAINT `CAT_PRD_ENTT_VCHR_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE, ADD CONSTRAINT `CATALOG_PRODUCT_ENTITY_VARCHAR_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE
    “`

    Thank you.

  • Rakesh Gupta

    I followed your instructions to update my Magento 2.2.6 to 2.3 but it failed at command > composer update

    Following is the error I’m getting :

    globltec@sg06 [NEW ~/public_html]# composer update
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.

    Problem 1
    – Installation request for magento/product-community-edition 2.3.0 -> satisf iable by magento/product-community-edition[2.3.0].
    – magento/product-community-edition 2.3.0 requires msp/recaptcha ^2.0.1 -> s atisfiable by msp/recaptcha[2.0.1, 2.0.2] but these conflict with your requireme nts or minimum-stability.

    globltec@sg06 [NEW ~/public_html]# ^C
    globltec@sg06 [NEW ~/public_html]#

    • Chirag

      Please try to disable msp/recaptcha module and check

      • Rakesh Gupta

        Tried your suggestion :

        globltec@sg06 [NEW ~/public_html]# php bin/magento msp:security:recaptcha:disable
        globltec@sg06 [NEW ~/public_html]# composer update
        Loading composer repositories with package information
        Updating dependencies (including require-dev)
        Your requirements could not be resolved to an installable set of packages.

        Problem 1
        – Installation request for magento/product-community-edition 2.3.0 -> satisfiable by magento/product-community-edition[2.3.0].
        – magento/product-community-edition 2.3.0 requires msp/recaptcha ^2.0.1 -> satisfiable by msp/recaptcha[2.0.1, 2.0.2] but these conflict with your requirements or minimum-stability.

        globltec@sg06 [NEW ~/public_html]#

        But still getting same problem/error.

      • Rakesh Gupta

        Sorry no success till now. Waiting for someone to help in upgrading.

        • Chirag

          Can you please check the minimal stability of magento/product-community-edition in msp/recaptcha module composer.json file? Or clear the composer cache using

          composer clear-cache

          and try again.

          • Rakesh Gupta

            How do I check minimal stability.

            The contents of msp/recaptcha composer.json file is as below :

            {
            “name”: “msp/recaptcha”,
            “description”: “Google reCaptcha integration for Magento2 – Member of MageSpecialist SecuritySuite”,
            “version”: “2.0.0”,
            “require”: {
            “php”: “^7.0|^7.1|^7.2”,
            “magento/magento-composer-installer”: “*”,
            “google/recaptcha”: “^1.1”
            },
            “suggest”: {
            “msp/security-suite”: “Full MageSpecialist Security Suite”
            },
            “authors”: [
            {
            “name”: “Riccardo Tempesta”,
            “email”: “riccardo.tempesta@magespecialist.it”
            }
            ],
            “type”: “magento2-module”,
            “license”: “OSL-3.0”,
            “autoload”: {
            “files”: [
            “registration.php”
            ],
            “psr-4”: {
            “MSP\\ReCaptcha\\”: “”
            }
            }
            }

            Please guide….

        • Admin

          By looking at a composer.json file, I can tell you that ReCaptcha version is 2.0.0 and Magento require Recaptcha version 2.0.1. I would suggest you should remove the ReCaptcha module completely as 2.3.0 inbuilt provide google ReCaptcha

          • Rakesh Gupta

            This also did not worked. Hence, decided to remove existing Magento 2.2.6 from Server and install 2.3 after data backup.

  • Alex

    Thanks! It helped a lot.

  • All the comments are goes into moderation before approval. Irrelevant comment with links directly goes to spam. Your email address will not be published.

    Was this post helpful? Please support Us!

    Follow us on twitter or Like us on facebook.

     


    To Avoid Spam Downloads, We Want Your Email

    We will send you download link right
    away. Please submit form below.
    SEND ME DOWNLOAD LINK
    Close

    Increase Your
    Magento 2
    Knowledge

    Get Weekly Tutorial
    to your Inbox
    Subscribe Me
    close-link
    Subscribe Here