I followed every step from this website : http://alanstorm.com/magento_config and I'm stuck with the observer.

I think smth is wrong with my Observer.php. I get this error :

a:5:{i:0;s:157:"Cannot send headers; headers already sent in /mnt/futurehome/netlogiq/public_html/attin/magento/app/code/local/Attila/Configviewer/Model/Observer.php, line 1";i:1;s:1142:"#0 /mnt/futurehome/netlogiq/public_html/attin/magento/lib/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true).....

I post this image : enter image description here

Also I comment the code from observer I did not get this error. Can someone help me with this ?

=> config.xml :


=> Observer.php :

    class Attila_Configviewer_Model_Observer {
        const FLAG_SHOW_CONFIG = 'showConfig';
        const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';     

        private $request;

        public function checkForConfigRequest($observer) {          
            $this->request = $observer->getEvent()->getData('front')->getRequest();
            if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){

        private function setHeader() {
            $format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ? 
            $this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';                                
                case 'text':
                    header("Content-Type: text/plain");
                    header("Content-Type: text/xml");

        private function outputConfig() {            
  • please share some of your code which you tried.if their is problem in code we can help you. Commented May 9, 2014 at 6:53
  • please check the post again :) Commented May 9, 2014 at 6:56
  • make sure that in the file Attila/Configviewer/Model/Observer.php you don't have any space or other character before the php opening tag (<?php) or after the closing tag ?>. Actually you can remove the closing tag completely if you have one.
    – Marius
    Commented May 9, 2014 at 6:56
  • @Marius thx man , that was the problem :D can I add you on skype ? Commented May 9, 2014 at 6:59

1 Answer 1


So this question will have an answer.

Based on the comments the problem was cause by a character (probably space) at the beginning of the observer file, before the php opening tag (<?php) and it was considered output.

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.