Check for open() syscalls
~> grep open strace.out
open("/var/www/wp1/wp-load.php", O_RDONLY) = 27
open("/var/www/wp1/wp-config.php", O_RDONLY) = 27
open("/var/www/wp1/wp-settings.php", O_RDONLY) = 27
open("/var/www/wp1/wp-includes/pomo/translations.php", O_RDONLY) = 27
open("/var/www/wp1/wp-includes/pomo/entry.php", O_RDONLY) = 27
open("/var/www/wp1/wp-includes/pomo/streams.php", O_RDONLY) = 27
open("/var/www/wp1/wp-includes/wp-db.php", O_RDONLY) = 27
open("/var/www/wp1/wp-includes/cache.php", O_RDONLY) = 28
open("/var/www/wp1/wp-includes/l10n.php", O_RDONLY) = 28
open("/var/www/wp1/wp-includes/default-widgets.php", O_RDONLY) = 28
open("/var/www/wp1/wp-includes/locale.php", O_RDONLY) = 28
open("/var/www/wp1/wp-includes/template-loader.php", O_RDONLY) = 28
open("/var/www/wp1/wp-content/themes/twentyeleven/header.php", O_RDONLY) = 28
open("/var/www/wp1/wp-content/themes/twentyeleven/style.css", O_RDONLY) = 28
open("/var/www/wp1/wp-content/themes/twentyeleven/footer.php", O_RDONLY) = 28
open("/var/www/wp1/wp-content/themes/twentyeleven/sidebar-footer.php", O_RDONLY) = 28
Conditional config include in wp-load.php
<?php
if ( file_existsABSPATH 'wp-config.php') ) {

        
/** The config file resides in ABSPATH */
        
require_once( ABSPATH 'wp-config.php' );

} elseif ( 
file_existsdirname(ABSPATH) . '/wp-config.php' ) && ! file_existsdirname(ABSPATH) . '/wp-settings.php' ) ) {

        
/** The config file resides one level above ABSPATH but is not part of another install */
        
require_once( dirname(ABSPATH) . '/wp-config.php' );

} else {

        
// A config file doesn't exist

        // Set a path for the link to the installer
        
if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false )
                
$path 'setup-config.php';
        else
                
$path 'wp-admin/setup-config.php';

        
define'WPINC''wp-includes' );
        
define'WP_CONTENT_DIR'ABSPATH 'wp-content' );
        require_once( 
ABSPATH WPINC '/load.php' );
        require_once( 
ABSPATH WPINC '/version.php' );

        
wp_load_translations_early();
        
wp_check_php_mysql_versions();

        
// Die with an error message
        
$die  __"There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
        
$die .= '<p>' __"Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
        
$die .= '<p>' __"You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
        
$die .= '<p><a href="' $path '" class="button">' __"Create a Configuration File" ) . '</a>';

        
wp_die$die__'WordPress &rsaquo; Error' ) );
}
Replace with
<?php
include './wp-config.php';
Get rid of require_once of wp-settings.php in wp-config.php
<?php
#require_once(ABSPATH . 'wp-settings.php');
require './wp-settings.php';
Get rid of require_once calls in wp-settings.php
<?php
#require_once( ABSPATH . WPINC . '/l10n.php' )
require './wp-includes/l10n.php';
...
require_once( 
ABSPATH WPINC '/locale.php' );
require 
'./wp-includes/locale.php';
Conditional did-header check in wp-blog-header.php
<?php
#if ( !isset($wp_did_header) ) {
#  $wp_did_header = true;
#  require_once( dirname(__FILE__) . '/wp-load.php' );
#  wp();
#  require_once( ABSPATH . WPINC . '/template-loader.php' );
#}
require './wp-load.php';
wp();
require 
'./wp-includes/template-loader.php';
?>
require_wp_db() call in wp-includes/load.php
<?php
function require_wp_db() {
        global 
$wpdb;

        require_once( 
ABSPATH WPINC '/wp-db.php' );
        if ( 
file_existsWP_CONTENT_DIR '/db.php' ) )
                require_once( 
WP_CONTENT_DIR '/db.php' );

        if ( isset( 
$wpdb ) )
                return;

        
$wpdb = new wpdbDB_USERDB_PASSWORDDB_NAMEDB_HOST );
}
Don't call require_wp_db() from wp-settings.php
<?php
#require_wp_db();
require './wp-includes/wp-db.php';
$wpdb = new wpdbDB_USERDB_PASSWORDDB_NAMEDB_HOST );
Hardcode built-in wp cache in wp-settings.php
<?php
require './wp-includes/cache.php';
$_wp_using_ext_object_cache false;
wp_cache_init();
wp_cache_add_global_groups( array( 'users''userlogins''usermeta''user_meta''site-transient''site-options''site-lookup''blog-lookup''blog-details''rss''global-posts' ) );
wp_cache_add_non_persistent_groups( array( 'comment''counts''plugins' ) );
#wp_start_object_cache();
PHP 5.3 has a __DIR__ constant - use in wp-load.php
<?php
#define( 'ABSPATH', dirname(__FILE__) . '/' );
define'ABSPATH'__DIR__ '/' );
Check again
~> grep open strace2.out
open("/var/www/wp2/wp-includes/pomo/translations.php", O_RDONLY) = 27
open("/var/www/wp2/wp-includes/pomo/entry.php", O_RDONLY) = 27
open("/var/www/wp2/wp-includes/pomo/streams.php", O_RDONLY) = 27
open("/var/www/wp2/wp-includes/default-widgets.php", O_RDONLY) = 28
open("/var/www/wp2/wp-content/themes/twentyeleven/header.php", O_RDONLY) = 28
open("/var/www/wp2/wp-content/themes/twentyeleven/style.css", O_RDONLY) = 28
open("/var/www/wp2/wp-content/themes/twentyeleven/footer.php", O_RDONLY) = 28
open("/var/www/wp2/wp-content/themes/twentyeleven/sidebar-footer.php", O_RDONLY) = 28
We just have translations, plugin widgets and themes left here now. We could hardcode these as well, but then we start to lose the main characteristics of Wordpress.