title: How do you get PHP, Symlinks and __FILE__ to work together nicely?
body: <p>On localhost. I have the following directory structure:</p>
  
  <p><code>/share/www/trunk/wp-content/plugins/otherfolders</code></p>
  
  <p><code>/share/www/portfolio/wp-content/symlink</code></p>
  
  <p>Where <code>symlink</code> is a symbolic link to <code>/trunk/.../plugins/</code>. Basically, this is because I need to test multiple WordPress installs and set them up, but I don't want to have to move plugins around and copy and paste them everywhere.</p>
  
  <p>However, sometimes I need to crawl up the directory tree to include a config file:</p>
  
  <pre><code> $root = dirname(dirname(dirname(dirname(__FILE__))));
        if (file_exists($root.'/wp-load.php')) {
            // WP 2.6
            require_once($root.'/wp-load.php');
        }
  </code></pre>
  
  <p>The folder always resolves to: </p>
  
  <p><code>/share/www/trunk</code></p>
  
  <p>Even when the plugin is being executed and included in</p>
  
  <p><code>/share/www/portfolio/</code>.</p>
  
  <p>Is it possible in PHP to include files in the <code>share/www/portfolio</code> directory from a script executing in a symlink to the <code>/share/www/trunk/.../plugins</code> directory?</p>
  
  <p>While this problem only happens on my test server, I'd like to have a safely distributable solution so <strong>crawling up an extra level is not an option</strong>.</p>