8

I tried to search for a difference but each time the vars are identical, any ideas ?

Asaf
  • 8,106
  • 19
  • 66
  • 116
  • 1
    Better answers at https://stackoverflow.com/questions/279966/php-self-vs-path-info-vs-script-name-vs-request-uri – Ian Dunn Jul 14 '16 at 18:30

2 Answers2

3

http://www.php.net/manual/en/reserved.variables.server.php

Based on my understanding of this, they can be different if you're executing through the command line (CLI).

AvatarKava
  • 15,245
  • 2
  • 27
  • 33
  • oh! ok then they are identical in 99.9% of my programming, thanks. – Asaf May 20 '10 at 07:41
  • 4
    @Asaf `SCRIPT_FILENAME` should contain an _absolute_ path, whereas `SCRIPT_NAME` is document root-relative, so they should be different is most web hosting environments, not "identical"? However, they can also refer to different files entirely if using an Apache `Alias`. In this case `SCRIPT_FILENAME` refers to the file being directed to, whereas `SCRIPT_NAME` appears to report the URL/file you are requesting. – MrWhite Jun 08 '15 at 15:16
1

Check THIS Difference:

  • script_filename returns REAL DIR C:/xampp/htdocs/demo/index.php

  • file returns LOGIC JUNKTION D:\www\local\demo\cms\init.php

Hold that in mind when checking pathes

Humer IT
  • 132
  • 3