Replaced __DIR__ and realpath() with path based on $_SERVER['DOCUMENT_ROOT']
to allow symlinking core.