Keeping your version of Magento up to date should be a "goes without saying" practice. When an update is published, it should be a priority to update your site to the latest version straight away whether that be version 1 or version 2 of the Magento platforms.
However, the process to install a patch might not appear to be as easy as first thought as there is no "one size fits all" solution.
The following steps should be taken before updataing a patch:
- Back up your magento installation - Its sound practice to create back ups of all the important magento files before applying a patch.
- Download the Patch - Visit the magento download page to download a new patch
- Disable the Compiler - If your store is compiled, make sure to disable compilation before installing a patch. After installing a patch, test the store thoroughly. Then, run the compiler again. Your store must be recompiled for the patch to take effect.
- Install the patch - using one of the 3 methods below.
Method 1: Using SSH
Secure Shell (SSH) is the recommended way to install a patch. If you don’t know how to set up SSH, contact your hosting provider.
- Upload the patch files to the root of your
[magento]
installation folder - If the store is compiled, make sure the compiler is disabled.
- In the SSH console, run the following commands according to the patch extension:
.SH extension
sh patch_file_name.sh
.patch extension
patch --p0<patch_file_name.patch
4. Use either of the following methods to verify that the patch was installed:
Download or view the file using the command: app/etc/applied.patches.list
From the command line, run the patch file with the --list
argument for a report of all patch installations.
If you need further help, magento's guide on updating using SSL is available
Method 2: Running a Script
The following example shows how to install the SUPEE_5344.sh patch. Make sure to replace the patch name in the example with the name of the patch file to be installed.
1. Upload the patch files to the root of your [magento] installation folder.
2. If the store is compiled, make sure the compiler is disabled.
3. From your desktop, do the following:
a. Use a text editor to create a file named patch.php that contains the following script.
<?php
print("<PRE>");
passthru("/bin/bash PATCH_SUPEE-5344.sh");
print("</PRE>");
echo "Done";
?>
b. Upload the patch.php file to the root of your [magento] installation folder.
4. Run the script from your browser.
http://www.[yourstore.com]/patch.php
Then, look for the following message: “Checking if patch can be applied/reverted successfully...
Patch was applied/reverted successfully. Done”
5. After the patch is successfully installed, delete the patch.php file from your server.
If you receive the following error, either ask your hosting provider to install the missing tools, or try one of the other methods.
“Error! Some required system tools, that are utilized in this sh script, are not installed; Tool (s) “patch” is (are) missed, please install it(them).
6. Refresh your cache from the Magento Admin, Don’t forget to refresh your OPcode or APC cache as well.
7. If your store is compiled, rerun the compiler.
Upload Pre-patched Files
- Download you Magento installation to your local machine
- Apply the patch locally
- Upload the updated files to your server