What is the difference between $_SERVER['SCRIPT_FILENAME] and $_SERVER['SCRIPT_NAME]? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between $_SERVER['SCRIPT_FILENAME] and $_SERVER['SCRIPT_NAME]?

As I learnt $_SERVER['SCRIPT_FILENAME'] returns path of currently executing file and also $_SERVER['SCRIPT_NAME] also return path of current file. If there is a difference how they can be used?

31st May 2017, 8:22 AM
Raghul
Raghul - avatar
3 Answers
0
in my case: $_SERVER['SCRIPT_FILENAME'] - returns full path of your script file, for example 'Z:/www/www.localhost/index.php' (Win) or '/home/www/index.php' (Debian) $_SERVER['SCRIPT_NAME'] - returns only file name '/index.php'
31st May 2017, 8:35 AM
Michal
Michal - avatar
0
Use _ (Underscore)
30th Dec 2020, 10:59 AM
Munish Rana
Munish Rana - avatar
0
_
17th May 2022, 6:40 AM
Megha Raj kandel