SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru DenverDave's Avatar
    Join Date
    Feb 2001
    Denver, Colorado
    0 Post(s)
    0 Thread(s)
    I'm sure that this must have been discussed a thousand times, but what is the story with $PHP_SELF not working "properly" under windows. As I understand it we have to override with $PHP_SELF = $PATH_INFO; for $PHP_SELF to have the correct value on each page or include file for each page.

    Parden me, but if this must be done every time for windows, why is $PHP_SELF not set to $PATH_INFO by PHP?

    Just curious - Love PHP4, but seems strange to me.


  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    San Diego, CA
    0 Post(s)
    0 Thread(s)
    The reason for this is because you are running php in CGI mode and it has nothing to do with it being on windows. If you run a script on unix through the php interpreter or in CGI mode, the path to the interprter becomes $PHP_SELF just like Windows. If you use PHP as a server module (ISAPI or Apache) on Windows you won't have that problem. If you would like to install php as a module for Apache on windows I suggest reading this link

    Also most of the bundles you can download normally install it as CGI on Windows, in order to make it work as an apache module you will need to chage the configuration in your httpd.conf file for Apache. Or use IIS and use the ISAPI module. For instructions on that see.

    Or a bit of a hack but you could do this create a file named header.php in it put this

    PHP Code:
    Now in your php.ini file change the auto_prepend_file directive to match the location of this newly created document header.php. somethiong like this:

    auto_prepend_file = C:\wwwroot\header.php
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts