title: Using symlinks for multiple instances of some CMS or Framework
body: <p>I wanted to set up multiple instances of a CMS in a way that they symlink to ressources that are 'static' part of the framework in question.</p>
  
  <p>In this case I've tried to do it with <code>Wordpress 4.5.2</code> on Arch Linux, running <code>nginx 1.10.0</code> with <code>php 7.0.6</code> and <code>MariaDB 10.1.14</code>. So I wanted to have everything but the contents of <code>wp-content/</code> and <code>wp-config.php</code> by reference:</p>
  
  <pre><code>$ ls -l /usr/share/nginx/html/wdev/wptest
  total 16
  lrwxrwxrwx  1 psi psi    46 May 25 19:15 index.php -&gt; /usr/share/nginx/html/wdev/wordpress/index.php
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 license.txt -&gt; /usr/share/nginx/html/wdev/wordpress/license.txt
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 readme.html -&gt; /usr/share/nginx/html/wdev/wordpress/readme.html
  lrwxrwxrwx  1 psi psi    52 May 25 19:15 wp-activate.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-activate.php
  lrwxrwxrwx  1 psi psi    45 May 25 19:15 wp-admin -&gt; /usr/share/nginx/html/wdev/wordpress/wp-admin
  lrwxrwxrwx  1 psi psi    55 May 25 19:15 wp-blog-header.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-blog-header.php
  lrwxrwxrwx  1 psi psi    57 May 25 19:15 wp-comments-post.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-comments-post.php
  -rw-r--r--  1 psi http 3092 May 25 04:08 wp-config.php
  drwxr-xr-x  4 psi psi  4096 May 25 19:15 wp-content
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 wp-cron.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-cron.php
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 wp-includes -&gt; /usr/share/nginx/html/wdev/wordpress/wp-includes
  lrwxrwxrwx  1 psi psi    54 May 25 19:15 wp-links-opml.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-links-opml.php
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 wp-load.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-load.php
  lrwxrwxrwx  1 psi psi    49 May 25 19:15 wp-login.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-login.php
  lrwxrwxrwx  1 psi psi    48 May 25 19:15 wp-mail.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-mail.php
  lrwxrwxrwx  1 psi psi    52 May 25 19:15 wp-settings.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-settings.php
  lrwxrwxrwx  1 psi psi    50 May 25 19:15 wp-signup.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-signup.php
  lrwxrwxrwx  1 psi psi    53 May 25 19:15 wp-trackback.php -&gt; /usr/share/nginx/html/wdev/wordpress/wp-trackback.php
  lrwxrwxrwx  1 psi psi    47 May 25 19:15 xmlrpc.php -&gt; /usr/share/nginx/html/wdev/wordpress/xmlrpc.php
  </code></pre>
  
  <p>As a "control-group" I have another instance <code>testpress</code> without the symlinks which is basically <code>cp -R /usr/share/nginx/html/wdev/wordpress/ /usr/share/nginx/html/wdev/testpress</code>.</p>
  
  <p>Now the <code>testpress</code> instance behaves and installs fine but the <code>wptest</code> doesn't at all. The two most striking issues so far:</p>
  
  <ul>
  <li>When using <code>testpress</code>'s <code>wp-config.php</code> pointing to the same database it doesn't recognize an existing installation but always goes straight into <code>wp-admin/setup-config.php</code> (installation procedure)</li>
  <li>When trying to install it brings up the database configuration page <code>setup-config.php?step=1</code> but after that trips on <code>setup-config.php?step=2</code> with nginx printing "An error occurred. Sorry, the page you are looking for is currently unavailable. Please try again later." Yet it doesn't produce any output whatsoever in the error logs (nginx and php).</li>
  </ul>
  
  <p>I probably should simply give up on this and not care about those few hundred MBs cluttering my storage space. But I've spent enough time on this now to get quite annoyed by it so any tips or ideas for sorting this out are super appreciated.</p>
  
  <p>The only guess I've come up with so far is that the use of PHP magic constants like <code>__FILE__</code> and similar might cause chaos in such an environment.</p>