I am attempting to install the SUPEE-5994 patch on Magento CE but the following error is occurring:

[root@server httpdocs]# sh PATCH_SUPEE-5994_EE_1.14.1.0_v1-2015-05-14-05-05-02.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
patching file app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
patching file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
patching file app/code/core/Mage/Customer/Model/Customer.php
patching file app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php
patching file app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php
patching file app/code/core/Mage/Install/Controller/Router/Install.php
patching file app/code/core/Mage/Install/etc/config.xml
patching file app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php
patching file downloader/Maged/Model/Connect.php
patching file downloader/Maged/View.php
patching file downloader/template/connect/packages_prepare.phtml
patching file downloader/template/messages.phtml
patching file get.php
can't find file to patch at input line 347
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|diff --git lib/PEAR/PEAR/PEAR.php lib/PEAR/PEAR/PEAR.php
|index b4633bf..e6f8edc 100644
|--- lib/PEAR/PEAR/PEAR.php
|+++ lib/PEAR/PEAR/PEAR.php
File to patch:
Skip this patch? [y]
Skipping patch.
42 out of 42 hunks ignored
patching file lib/PEAR/PEAR/PEAR5.php
patching file lib/Varien/Io/File.php

Does anyone know how to resolve this?

5 Answers 5


According to the output it seems like lib/PEAR/PEAR/PEAR.php does not exist in your Magento installation. To solve the issue I would suggest to:

  • obtain lib/PEAR/PEAR/PEAR.php from Magento distribution (you can download it at https://www.magentocommerce.com/products/downloads/magento/)
  • backup your lib/PEAR/PEAR/PEAR.php (if there is such file somehow despite the output)
  • upload original lib/PEAR/PEAR/PEAR.php from Magento distribution
  • apply the patch

I seem to be having the same issue where it fails at the PEAR.php, I get a slightly different error though:

patching file downloader/template/messages.phtml
patching file get.php
Hunk #1 succeeded at 36 (offset -1 lines).
patching file lib/PEAR/PEAR/PEAR.php
Hunk #1 FAILED at 6.
Hunk #2 FAILED at 52.
Hunk #42 FAILED at 1115.
42 out of 42 hunks FAILED -- saving rejects to file lib/PEAR/PEAR/PEAR.php.rej
  • Interesting. The patch installed fine for us on a couple of installations but not on
    – Chris
    Commented May 15, 2015 at 16:15
  • I tried on, then found in the magento connect manager there was an update, so I've since updated to, but it still fails for the same reason.
    – Chris
    Commented May 15, 2015 at 16:20
  • Whats getting weirder is that this patch has not successfully installed, I've compared the before and afters and no changes were made, yet, magentos security checker says the site is patched! magento.com/security-patch-check{magento_webiste_URL}/{admin_path} Even more crazy, I patched another site which installed the patch with no issues and came up successful, this site now fails the security checks.
    – Chris
    Commented May 19, 2015 at 9:32
  • Just come across this issue on a Magento store and the lib/PEAR/PEAR/PEAR.php was the correct file for this version. I replaced it with one from the original distribution though anyway and it still won't patch...
    – zigojacko
    Commented Jul 15, 2015 at 7:35
  • And there is no file lib/PEAR/PEAR/PEAR.php.rej being created either. And there are no permissions issues. Very odd.
    – zigojacko
    Commented Jul 15, 2015 at 7:36

The Hunk FAILED at ...suggests that the core files that the patch is attempting to be change have been modified and/or do not contain the correct code for the patch to be applied. Make sure that the core files ARE original (compare to a fresh installation file) and that your are using the correct patch for your magento version. You can check your version at the bottom of your admin screen.

If your core files have been modified you are in trouble. You should never modify core files directly for this reason. Make sure you have copies of your altered files as you will need to reference these when re-modding the updated files later - but only modify local copies that override the core.

  • I kind of answered the answer there, sorry. Commented May 15, 2015 at 16:34

I have exactly the same error (I reported yesterday but in an "old" question) in a fresh installation of with downloader.php, there is no PEAR folder in the original download, do you need this PEAR folder or only to fix this issue ?

Own answer : Yes, that is a difference with downloader.php you don't get /lib/PEAR but with a manually download /lib/PEAR is included. So I copied /lib/PEAR and indeed now the patch is running normally without errors.



Had a similar error on installation:

patching file lib/PEAR/PEAR/PEAR.php
Hunk #1 FAILED at 6.
Hunk #2 FAILED at 52.
Hunk #3 FAILED at 92.
Hunk #4 FAILED at 101. 

... etc.

and I replaced the CR LF with just LF in the file lib/PEAR/PEAR/PEAR.php, and now the patch worked! (... it was the original file!).

Just for the record, the same happened patching the PATCH_SUPEE-6285_CE_1.7.0.2_v1-2015-07-07-09-09-08.sh, but now the

patching file `app/design/frontend/default/modern/template/checkout/cart.phtml
Hunk #1 FAILED at 97.

(... yes the original). Again replaced CR LF with just LF, and it worked.

  • What is CR and LF?
    – zigojacko
    Commented Jul 15, 2015 at 7:32
  • CR and LF are equivalent to the PHP strings "\r" and "\n", respectively. CR stands for "carriage return" and LF stands for "line feed", those are terms that are relevant for old matrix printers. So "replaced CR LF with just LF" just means, "replaced Windows line breaks with Unix line breaks".
    – toon81
    Commented Aug 19, 2015 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.