What is the difference between $_SERVER["SCRIPT_NAME"] and realpath('.') in PHP?

$_SERVER["SCRIPT_NAME"] returns the path of the current script relative to the document root, while realpath('.') returns the absolute path of the current working directory. If you need the absolute path of the current script, you should use realpath($_SERVER["SCRIPT_NAME"]) to get the correct path.

$absolutePath = realpath($_SERVER["SCRIPT_NAME"]);
echo $absolutePath;