Posts Tagged ‘wp-config.php’

Hello world!

Sunday, June 8th, 2008

Launched my first blog post after installing WordPress! Wow….

I installed wordpress in a codebase -> symlink jailed public_html structure. So the WordPress code is seperated from the blog specific content. On this way Wordpress can easliy be upgraded, and I can easily create another independend blogs.

  • ~/wordpress/ contains all unchanged wordpress code and can be upgraded by extracting a new tar ball.
  • ~/public_html/bastiaan/ contains a symlink jail to ~/wordpress/
    Non-shared items like wp-config.php are just individual files.

I had to hack a new ~/wordpress/wp-config.php so it uses the wp-config.php from the link jail directory (found by $_SERVER['SCRIPT_FILENAME']):


/* 2008 Bastiaan Welmers haasje@welmers.net - wp-config.php usefull for symlink jails */
$dir = dirname($_SERVER['SCRIPT_FILENAME']) . '/';
for ($i = strlen($dir); $i > 0; $i–) {
    if ($dir[$i] == '/') {
        if (file_exists(substr($dir, 0, $i) . '/wp-config.php')) {
              include(substr($dir, 0, $i) . '/wp-config.php');
              break;
        }
    }
}
?>

Update: fixed code block :D