What purpose we using $_SERVER[‘SCRIPT_FILENAME’] ?

It returns the absolute pathname of the currently executing script.

Note:
If a script is executed with the CLI(Command-line interface), as a relative path, such as file.php or ../file.php, $_SERVER[‘SCRIPT_FILENAME’] will contain the relative path specified by the user.