We are using Magento

We have one store with two store views, english and spanish. Everything worked well in MAMP. But, after migrating the store to our live server and getting one order from each view, we found out in the spanish store we get an error when trying to print the invoices.

This is the latest log generated.

a:5:{i:0;s:143:"Cannot send headers; headers already sent in /homepages/40/d504285318/htdocs/app/code/local/Excellenceredsys/Redsys/Model/Payredsys.php, line 2";i:1;s:1505:"#0 /homepages/40/d504285318/htdocs/lib/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /homepages/40/d504285318/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(1065): Zend_Controller_Response_Abstract->setHeader('Pragma', 'public', true)
#2 /homepages/40/d504285318/htdocs/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php(121): Mage_Core_Controller_Varien_Action->_prepareDownloadResponse('invoice2014-10-...', '%PDF-1.4\n%\xE2\xE3\xCF\xD3\n...', 'application/pdf')
#3 /homepages/40/d504285318/htdocs/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php(489): Mage_Adminhtml_Controller_Sales_Invoice->printAction()
#4 /homepages/40/d504285318/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_InvoiceController->printAction()
#5 /homepages/40/d504285318/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('print')
#6 /homepages/40/d504285318/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 /homepages/40/d504285318/htdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#8 /homepages/40/d504285318/htdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#9 /homepages/40/d504285318/htdocs/index.php(88): Mage::run('', 'store')
#10 {main}";s:3:"url";s:93:"/index.php/admin/sales_order_invoice/print/invoice_id/1/key/e8c732175322411fbbf4d923978aa674/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:9:"store_spa";}

I tried other solutions offered in these forums, like this one and this one, but none of them worked.

Any help will be much appreciated. As I said, it only happens in one store view.

Thank you very much.

1 Answer 1


For sure the local plugin you installed is the one giving the error. did you try to disable the plugin and then printing the invoice. If this solves it, this gives you a lot better perspective in solving it.

Headers already sent mostly i due to code, or errors echoing before the page is generated. Thus multiple headers are send. Please check that first and reply with feedback so we can help you look further

  • Thank you, Kay. I tried what you suggested, disabling the module Excellenceredsys and refreshing the cache, and it still didn't work. I read in other threads it could be a PHP incompatibily that could be solved with a patch Magento released, but I haven't been able to implement that. I don't know how to apply a patch.
    – Alberto
    Commented Oct 27, 2014 at 10:40
  • Did the error message change now becuase sometimes the cache is not enough of disabling is not enough. Commented Oct 27, 2014 at 15:29
  • No, it didn't change. The new error generated is the same one as the one in my first post.
    – Alberto
    Commented Oct 28, 2014 at 12:37
  • I just solved this issue. The problem was a linebreak in line 1 of the file mentioned in the error log, which was causing the headers being sent twice. Deleting the linebreak solved the problem. More info in this stackoverflow thread
    – Alberto
    Commented Oct 29, 2014 at 14:45

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