-2

If I access my current test-project on root (http://--website--.we/) the loading time takes 5.22s. If I access any subsite (http://--website--.we/login), which refers to the very same files (since there is a htaccess "FallbackResource /index.php") the load time is okay.

I already tried to remove all Javascripts, and analyzed the site with firefox developer tools and chrome developer tools


  <div class="container-fluid">
          <?php
                $path = explode('/', ltrim($_SERVER['REQUEST_URI'], '/'));
            if(empty($path[0])) {                       // No path elements means home
                 Print ("home");
                     include ("inc/login.inc.php");
             } else switch(array_shift($path))             // Pop off first item and switch
            {
                     case 'login':
                            include ("inc/login.inc.php");
                            break;
                      default:
                        break;
        }
          ?>
          <div id="server-results"><!-- For server results --></div>
</div>

EDIT:

found out that if I remove my htaccess file its working fine. The file only has got one line

FallbackResource /index.php

SOLUTION:

The Problem is some Bug with Apaches "FallbackResource". I simply had to add two lines in my htaccess file:

DirectoryIndex disabled
DirectoryIndex index.php
FallbackResource /index.php

As seen here: https://serverfault.com/questions/559067/apache-hangs-for-five-seconds-with-fallbackresource-when-accessing

Dharman
  • 30,962
  • 25
  • 85
  • 135
user154501
  • 49
  • 5
  • Maybe your homepage does more with the database than say your login page? Would look at using something like xdebug to profile. – ficuscr Jun 26 '19 at 20:23
  • 1
    The loading time depends on *so many* variables, it's just too broad – GalAbra Jun 26 '19 at 20:26
  • But then the whole DOM wont get posted til the Database Processes are finished? The whole website is received within <300ms the rest the browser seems to idle – user154501 Jun 26 '19 at 20:28
  • It all depends. Lot of factors, compression, server configuration, etc. Profile the code execution I think is next step. – ficuscr Jun 26 '19 at 20:29
  • Using the developer mode, you identified which page item is taking a long time? Debug that one. Remove stuff until you find the culprit. That first page must do something that the others do not (connect to db, setup session, extra JavaScript, ...). You say the browser seems to idle, that points to JavaScript to me since it is executed in the browser. Also compare loading the page if already login and not. It might point out a section to look at. That being said, it is too broad a question to give a definitive answer. – Nic3500 Jun 26 '19 at 20:33
  • Okay so i found out it works fine if I remove my htaccess file. So I seem to do something wrong in there... posted the file up there – user154501 Jun 26 '19 at 20:40
  • fwiw [How to debug Apache mod_rewrite](https://stackoverflow.com/questions/9632852/how-to-debug-apache-mod-rewrite) – ficuscr Jun 26 '19 at 20:43
  • Found the Solution here ... https://serverfault.com/questions/559067/apache-hangs-for-five-seconds-with-fallbackresource-when-accessing Thanks for the help – user154501 Jun 26 '19 at 20:52
  • Please update the question and make the link to the solution clear. It will save others the time to search through the comments. – Markus Deibel Jun 27 '19 at 04:18
  • Please post your solution as answer – Raptor Jun 27 '19 at 09:22

1 Answers1

0

SOLUTION:

The Problem is some Bug with Apaches "FallbackResource". I simply had to add two lines in my htaccess file:

DirectoryIndex disabled
DirectoryIndex index.php

FallbackResource /index.php

As seen here: https://serverfault.com/questions/559067/apache-hangs-for-five-seconds-with-fallbackresource-when-accessing

user154501
  • 49
  • 5