We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    For some reason MODX is taking forever to load and I cannot pinpoint the problem, I’ve put write a PHP file (ie: Hello world) and this loads fine and quickly, but MODX takes forever.

    Is there a way to switch on debug mode, or a stopwatch to see how long processes is taking -- and find out which is taking the longest?

    Thanks.
      • 32645
      • 377 Posts
      I have tracked the problem down to the config file, inside the startCMSSession() function

      For some reason, if I put a die before it calls session_start, its fine.. if I put a die after session_start it takes forever!

      	function startCMSSession()
      	{
      		global $site_sessionname;
      		
      		session_name($site_sessionname);
      		die(__FUNCTION__);  // putting the die here is fine.
      		session_start(); 
                      die(__FUNCTION__);  // putting the die here takes forever to load.
      		// rest of function code is here...
      


      Is there an alternative way around this? I’ve tried commenting out session_start and putting a @ infront of it...

      If there is an alternative way, please provide instructions.

      Thanks
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: worchyld at May 11, 2009, 09:17 AM

        I have tracked the problem down to the config file, inside the startCMSSession() function

        For some reason, if I put a die before it calls session_start, its fine.. if I put a die after session_start it takes forever!

        Is there an alternative way around this? I’ve tried commenting out session_start and putting a @ infront of it...

        If there is an alternative way, please provide instructions.
        This is an issue with your server and the session handler configured for PHP, and nothing to do with MODx. Without details on the server configuration, it’s difficult to know what exactly the problem is, as it could be any number of things based on the session configuration.
          • 32645
          • 377 Posts
          I figured out the problem.

          Turns out it wasn’t the way it was handling sessions at all. In fact, it was a coding error I made for displaying a placeholder.

          What happened was that in a loop I used `i` as a variable to store a number but what I didn’t realise was that I already used `i` beforehand to store a different number and so it was creating an infinite loop where the property of `i` kept changing, hence it always taking forever to load.

          Anyway, the problem has now been resolved.