Revert "Replaced __DIR__ and realpath() with path based on $_SERVER['DOCUMENT_ROOT']"

This reverts commit 06d885af0ac88725a31ceeb89ef550ae90ee6abd.