The first php file loaded when you access a WordPress site is index.php under the root directory of the site. It is a very simple file with only 2 lines of codes:
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
The included wp-blog-header.php is also simple:
$wp_did_header = true;
require_once( dirname(__FILE__) . '/wp-load.php' );
require_once( ABSPATH . WPINC . '/template-loader.php' );
Basically, wp-blog-header.php loads wp-config.php. wp-config.php defines some constants such as the wordpress database information(user, password, etc., you input the correct information in this file to install WordPress). wp-config.php also loads wp-settings.php. Things get complicated in wp-settings.php as it loads a number of files.
The first two files wp-settings.php loads are wp-includes/load.php and wp-includes/default-constants.php, which define some functions that are called later in wp-settings.php. One of the functions that is called immediately after files loaded is
wp_initial_constants. By looking into this function, we can get the anwser to the often asked question: how much memory does a WordPress site use? It is determnined by the constant WP_MEMORY_LIMIT set here(default 40M). Specifically, WordPress uses 40M memory, and if the memory_limit setting in php.ini is less than 40M, memory_limit will be set to 40M too. So if a VPS marchant induces you to buy their 2G memory VPS by telling you that your WordPress site only runs under that much memory, ignore it now. Another important function called in wp-settings.php is
require_wp_db(defined in wp-includes/load.php) which news a db class for database operations.
Some important functions like
add_filter which is often used by WordPress plugin developers are also introduced in wp-settings.php by including corresponding files(such as wp-includes/plugin.php).
We will talk more about wp-settings.php in the next chapter.