How To Apply Magento 2 Patches

Day by day Magento 2 have been releasing their magento 2 patches to make it stable and more secure. Applying the Magento 2  Patches is being considered as tricky part and mostly developer are become confused while doing this, but its simple and required few steps to do as explain following.

Magento 2 has downloadable security patches, it can download from https://magento.com/tech-resources/download

Some of the patches are available in partner portal only, if you are Magento partner you can download the patches from there.

Magento 2 Patches

1) Using Git Environment

If you have git installed on your environment just use the following, copy the patch on you magento root folder and run the command below.
$ git apply MAGETWO-67805-2017-05-17-03-04-03.patch

2) Using PHP Script

  1. Download the patch file from magento official website.
  2. Upload it into the root folder of your magento store.
  3. Make one file with the name of patch.php in root directory, write following code in it.
    <?php
        print("<PRE>");
        passthru("/bin/bash CE-MAGETWO-67805.patch");
        print("</PRE>");
        echo "Done";
    ?>
  4. The patch file name should be CE-MAGETWO-67805.patch.
  5. Run the file from the browser. You should receive success message screen once you run patch.php from the browser.
  6. Clear and flush the magento cache.
(Visited 100 times, 1 visits today)