Problem with PHP enviromental variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Spidah

    Problem with PHP enviromental variables

    I have set up PHP with Apache on windows xp.

    However I notice that the SCRIPT_NAME & SCRIPT_FILENAME enviromental
    variables are incorrectly being set to php.exe

    Is there a way around this?

    Thanks

    Hamilton


  • Andy Hassall

    #2
    Re: Problem with PHP enviromental variables

    On Fri, 5 Mar 2004 11:50:22 +1300, "Spidah" <h.laughland@eg gstra.co.nz> wrote:
    [color=blue]
    >I have set up PHP with Apache on windows xp.
    >
    >However I notice that the SCRIPT_NAME & SCRIPT_FILENAME enviromental
    >variables are incorrectly being set to php.exe
    >
    >Is there a way around this?[/color]

    Run PHP as an Apache module, not as CGI? You should also end up with better
    performance that way.

    (I've not tested running as CGI to see if this does set those two variables to
    the php.exe executable, so it's just a guess, but it sounds reasonable that it
    would do this when run as CGI)

    Or use $_SERVER['PHP_SELF'] if you want the current script.

    --
    Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
    <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>

    Comment

    • Spidah

      #3
      Re: Problem with PHP enviromental variables

      I have tried setting up php as an Apache Modlue. Followed the instructions
      to the letter and it is loading ok.

      However when I try to run a .php file IE wants to download it instead of
      displaying it in the browser.

      What have I done wrong?

      Hamilton

      "Andy Hassall" <andy@andyh.co. uk> wrote in message
      news:o6ff40t7iq id1nk8uorkc5jqh 0f7dqnb0j@4ax.c om...[color=blue]
      > On Fri, 5 Mar 2004 11:50:22 +1300, "Spidah" <h.laughland@eg gstra.co.nz>[/color]
      wrote:[color=blue]
      >[color=green]
      > >I have set up PHP with Apache on windows xp.
      > >
      > >However I notice that the SCRIPT_NAME & SCRIPT_FILENAME enviromental
      > >variables are incorrectly being set to php.exe
      > >
      > >Is there a way around this?[/color]
      >
      > Run PHP as an Apache module, not as CGI? You should also end up with[/color]
      better[color=blue]
      > performance that way.
      >
      > (I've not tested running as CGI to see if this does set those two[/color]
      variables to[color=blue]
      > the php.exe executable, so it's just a guess, but it sounds reasonable[/color]
      that it[color=blue]
      > would do this when run as CGI)
      >
      > Or use $_SERVER['PHP_SELF'] if you want the current script.
      >
      > --
      > Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
      > <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>[/color]


      Comment

      • jn

        #4
        Re: Problem with PHP enviromental variables

        "Spidah" <h.laughland@eg gstra.co.nz> wrote in message
        news:TXP1c.2266 $Nc3.37585@news .xtra.co.nz...[color=blue]
        > I have tried setting up php as an Apache Modlue. Followed the instructions
        > to the letter and it is loading ok.
        >
        > However when I try to run a .php file IE wants to download it instead of
        > displaying it in the browser.
        >
        > What have I done wrong?
        >
        > Hamilton
        >
        > "Andy Hassall" <andy@andyh.co. uk> wrote in message
        > news:o6ff40t7iq id1nk8uorkc5jqh 0f7dqnb0j@4ax.c om...[color=green]
        > > On Fri, 5 Mar 2004 11:50:22 +1300, "Spidah" <h.laughland@eg gstra.co.nz>[/color]
        > wrote:[color=green]
        > >[color=darkred]
        > > >I have set up PHP with Apache on windows xp.
        > > >
        > > >However I notice that the SCRIPT_NAME & SCRIPT_FILENAME enviromental
        > > >variables are incorrectly being set to php.exe
        > > >
        > > >Is there a way around this?[/color]
        > >
        > > Run PHP as an Apache module, not as CGI? You should also end up with[/color]
        > better[color=green]
        > > performance that way.
        > >
        > > (I've not tested running as CGI to see if this does set those two[/color]
        > variables to[color=green]
        > > the php.exe executable, so it's just a guess, but it sounds reasonable[/color]
        > that it[color=green]
        > > would do this when run as CGI)
        > >
        > > Or use $_SERVER['PHP_SELF'] if you want the current script.
        > >
        > > --
        > > Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
        > > <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>[/color]
        >
        >
        >[/color]

        You have to add lines similar to these in your Apache's http.conf:

        LoadModule php4_module h:/php-4.2.1-Win32/sapi/php4apache.dll
        AddModule mod_php4.c
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps


        Comment

        Working...