You are here

What happens exactly when you request a Drupal webpage?

I have found the best blog series on what happens behind the scenes when you request a page on a Drupal site.  It's from becircle.com.

I would not even begin to try re-explaining this in my own way because the series really is excellent.  Many start building and developing drupal websites without going down the rabbit hole of all the functions that get called upon a page request, but if you're getting serious about custom development or contributing to Drupal core - go ahead and get your feet wet with the following posts.

Having this knowledge can help you in many ways as you begin to develop more complicated modules or customizations on your site.  As a single example of how a deeper knowledge of Drupal's inner workings can help you - do you know which Drupal hooks always get called even if Drupal is going to serve a cached version of your page? (hook_boot is the answer)

So, without further ado, here is the series I recommend:

  1. Introduction: what is in the drupal index.php file that gets called each time you request a page
  2. About drupal_bootstrap: overview of all the phases of the bootstrap process
  3. drupal_bootstrap (Configuration phase): error handling code is prepared, php settings are modified, settings.php gets loaded and some key global variables that Drupal uses throughout are initialized
  4. drupal_bootstrap (Page cache phase): figure out if the requesting IP is blocked, if user is logged in or not and if caching is enabled to decide whether to try to serve the page from cache (or at all).
  5. drupal_bootstrap (Database phase): redirects to install.php if no $databases array has been defined in settings.php yet, checks if this is a call from its testing system (in which case it uses a separate set of tables), loads database.inc, and more
  6. drupal_bootstrap (Variables phase): load all variables from the database variables table, then overwrite the ones that were defined in settings.php (if applicable), since those always trump the db values.  Load module.inc and any .module files that are required during the bootstrap phase

Here, unfortunately, the series abruptly ends before going through all the phases.  I did find an additional blog post about the next bootstrap phase (DRUPAL_BOOTSTRAP_SESSION) from facingworlds.com.

Let us know if you've found other good reads about Drupal's inner workings!

Share

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.