Proper DOCUMENT_ROOT when using mod_vhost_alias. Source http://jbenner.net/blog/quick-tip-get-proper-document-root-when-using-mod-vhost-alias
<?php
apache_setenv("DOCUMENT_ROOT",
$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME'])
);
?>
// Note: httpd-vhosts.conf filename just used as an example.
// Add the following line to your apache configuration inside the VirtualDocumentRoot vhost definition
// E.g.
// <VirtualHost *:80>
// ...
// {paste here}
// </VirtualHost>
php_admin_value auto_prepend_file "/Users/USERNAME/Sites/setdocroot.php"