If you really want to evolve from a web developer skillful enough to put together a functional “puzzle” out of Drupal's core modules, to one custom-making his new modules, then you need to take a close look at the whole process behind this apparently simple sequence: “you hit an URL, then (as if by magic) the required page instantly gets loaded”.
So, ready to take a sneak peek “behind the curtains”? If yes, then allow us to be your guide!

1. Drupal Separates The Internal Path from the Domain Name

Once the server gets the message, once the URL is sent, Drupal focuses on the internal path and on it only. Therefore, it just “cuts it off” from the URL.

2. Then Drupal Calls Index.php

Take the index.php as some sort of a “control tower” (you can find it in the root directory of the Drupal install), the one that processes all the incoming requests. 
Now, let's have a closer look! Index.php is made of 4 lines, each one of them performing a certain function:
  • define('DRUPAL_ROOT', getcwd(): the very first line that runs once Drupal gets a page request
  • require_once DRUPAL_ROOT . '/includes/bootstrap.inc': its role is that of loading  bootstrap.inc in the includes/subdirectory.bootstrap.inc
  • drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL): it loads pretty much everything: the modules and functions, the needed data into the memory...
  • menu_execute_active_handler(): as the name says it, it's the one actually handling the page request, delivering the final web page to the end user 

3. Now Drupal Goes Through the Bootstrap Process

This is where the “major loading” happens: it is now that Drupal loads the libraries, initializes the database, sets the right sessions... 
The bootstrap process a self-start one, requiring no input, no intervention from you, the website's “creator”, and yet... you can't possibly not know what happens during this whole process running on its own!
How about going rapidly through all the 8 phases of this highly complex bootstrapping process?
1. DRUPAL_BOOTSTRAP_CONFIGURATION: Drupal calls upon it wherever it encounters php errors or exceptions. If so, then an error handling code is prepared, settings.php gets loaded, configuration gets initialized...
2. DRUPAL_BOOTSTRAP_PAGE_CACHE: it checks whether the IP is blocked or not, whether the cache is enabled or not in order to serve the page from the cache
3. DRUPAL_BOOTSTRAP_DATABASE: it loads the database and checks whether any $databases array has been defined. If no, then it redirects to install.php
4. DRUPAL_BOOTSTRAP_VARIABLES: it loads the variables from the database variables table, then it overwrites the ones defined in settings.php, while loading all the other modules needed during this process   
5. DRUPAL_BOOTSTRAP_SESSION: it initializes the session handlers. There are several custom session handlers in Drupal:
  • _drupal_session_open() and_drupal_session_close(): to open and close a connection
  • _drupal_session_read(): gets the session from the sessions table
  • _drupal_session_write(): checks whether the session has been updated and writes a new one to the databse
  • _drupal_session_destroy(): it deletes cookies and cleans up a specific session
  • _drupal_session_garbage_collection(): it deletes the outdated sessions
6. DRUPAL_BOOTSTRAP_PAGE_HEADER: it practically sets up the HTTP header
7.  DRUPAL_BOOTSTRAP_LANGUAGE: called upon only for multilingual websites, it initializes the right language for the future web page
8. DRUPAL_BOOTSTRAP_FULL: the very final step, where all the modules are enabled and hook_init() is invoked

4. Drupal's Menu System Steps In

From all of Drupal's modules, it's the menu system that “guides” the internal path to a callback function.



5. Finally, It's the Theme System That Styles the Requested Page

Being more than just a theme (since it's a mix of theme functions and templates), the theme system is the one “dictating” the content/ the web page's final look. 


Of course that each process of this whole page request handling mechanism in Drupal requires a lot more in-depth knowledge, but this is pretty much the overall mental scheme that each developer should know for:
1. boosting his self-confidence with powerful knowledge
2. being able to come up with his own future custom modules    

We do Drupal development

Go to our Drupal page!

Visit page!

Browse cities

Recommended Stories

Accessibility in MarTech: A Strategic Imperative for 2024
 The importance of accessibility in MarTech goes beyond mere compliance with legal standards; it… (Read more)
5 Mins /
AI in Marketing: The Revolution
 The continuous use of AI in marketing is one of the most significant MarTech trends in 2024, driven by… (Read more)
5 mins /
 Beyond Buzzwords: MarTech Trends in 2024
 Marketing technology, or MarTech, is a collection of software and tools designed to enhance marketing… (Read more)
10 mins /