use $_SERVER['HOME'] for ~ replacement