We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13447
    • 5 Posts
    Site went down yesterday and I can’t find any help for this topic. Any help is appreciated!

    This is the error message I’m getting when trying to log into the manager. The website home page just displays a blank page.

    Parse error: parse error, unexpected ’\"’, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/sicyocom/public_html/modx/manager/includes/config.inc.php on line 18

    Here is the code:

    // automatically assign base_path and base_url
    if($base_path==""||$base_url=="") {
    $a = explode("/manager",str_replace("\","/",dirname($_SERVER["PHP_SELF"])));
    if(count($a)>1) array_pop($a);
    $url = implode("manager",$a); reset($a);
    $a = explode("manager",str_replace("\","/",dirname(__FILE__)));
    if(count($a)>1) array_pop($a);
    $pth = implode("manager",$a); unset($a);
    $base_url = $url.(substr($url,-1)!="/"? "/":"");
    $base_path = $pth.(substr($pth,-1)!="/" && substr($pth,-1)!="\"? "/":"");
    $site_url = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')? 'http://' : 'https://';
    $site_url .= $_SERVER['HTTP_HOST'];
    if($_SERVER['SERVER_PORT']!=80) $site_url = str_replace(':'.$_SERVER['SERVER_PORT'],'',$site_url); // remove port from HTTP_HOST 
    $site_url .= ($_SERVER['SERVER_PORT']==80 || isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS'])=='on')? '':':'.$_SERVER['SERVER_PORT'];
    $site_url .= $base_url;
    }
    


    Thanks!
      • 33372
      • 1,611 Posts
      This is indeed a very odd error, and you’re at least the second one to report it. It seems as if double backslashes have been replaced with single backslashes in three places in the code you posted. It should read:
      	// automatically assign base_path and base_url
      	if($base_path==""||$base_url=="") {
      		$a = explode("/manager",str_replace("\\","/",dirname($_SERVER["PHP_SELF"])));
      		if(count($a)>1) array_pop($a);
      		$url = implode("manager",$a); reset($a);
      		$a = explode("manager",str_replace("\\","/",dirname(__FILE__)));
      		if(count($a)>1) array_pop($a);
      		$pth = implode("manager",$a); unset($a);
      		$base_url = $url.(substr($url,-1)!="/"? "/":"");
      		$base_path = $pth.(substr($pth,-1)!="/" && substr($pth,-1)!="\\"? "/":"");
      		$site_url = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')? 'http://' : 'https://';
      		$site_url .= $_SERVER['HTTP_HOST'];
      		if($_SERVER['SERVER_PORT']!=80) $site_url = str_replace(':'.$_SERVER['SERVER_PORT'],'',$site_url); // remove port from HTTP_HOST 
      		$site_url .= ($_SERVER['SERVER_PORT']==80 || isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS'])=='on')? '':':'.$_SERVER['SERVER_PORT'];
      		$site_url .= $base_url;
      	}

      And of course your database configs should be above that, and the cms session function call below it (this is from a 0.9.6 config file)...

      If you change this code can you login normally again?
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 13447
        • 5 Posts
        ok, some progress... now I get the following error: (I’m posting all details so others can benefit from this posting.)

        Parse error: parse error, unexpected ’[’ in /home/sicyocom/public_html/modx/assets/cache/siteCache.idx.php on line 153

        I changed this code from <a href=’[+action+]’>[+logouttext+]</a> to <a href="[+action+]">[+logouttext+]</a>

        Then I got this error:

        Parse error: parse error, unexpected T_CLASS in /home/sicyocom/public_html/modx/assets/cache/siteCache.idx.php on line 264

        And the code is:
        $class = (isset($class))? ' class="'.$class.'"' : '';


        And I’m stuck here... thanks for your help!
          • 33372
          • 1,611 Posts
          Try just clearing your site cache (Site -> Clear Cache).

          Assuming that fixes things, then also let us know if you’re seeing a warning about your config file being writeable. You should’ve changed the permissions on that file to 644 after the install was complete, which would make it very unlikely that the file could be modified automatically by any script. Something like this could probably happen on upload in some circumstances, but after that I’m not sure how it would get changed...

          What is your server setup, and just in case this may have happened on upload what FTP program are you using?
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 13447
            • 5 Posts
            The operating system is FreeBSD 4.11 and I’m using mostly Dreamweaver to upload and manage the site. The config file did not have the right permissions so I have changed it to 644. Could that have been the problem?

            Where do I clear the site cache? In an FTP program (tried that) or in MODx Manager? I can’t login.

            Thanks for your help!
              • 33372
              • 1,611 Posts
              Hmm yes you do clear your site cache in the Manager. I think you could also re-upload the default siteCache.idx.php file and that would effectively clear it. You might want to rename your existing file rather than deleting it just in case though (I don’t think the installer puts anything important in there, but that way you’d have it around if it turns out you need it again).
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                • 13447
                • 5 Posts
                Yipee! We’re back in business.

                So, the final step was to upload the default siteCache.idx.php file and then I was able to access the Manager to Refresh the Site (cache)


                Thank you so much for your help ZAP!
                  • 33372
                  • 1,611 Posts
                  You’re very welcome. Now all we have to do is to figure out how it happened in the first place. I’d almost be willing to bet that the other person who experienced this is also using Dreamweaver to FTP their files...
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options