Apache/PHP Post Variables

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

    Apache/PHP Post Variables

    I'm working with someone on a PHP project. The other person is doing
    testing of scripts on their personal machine using Apache as a web server.
    The production server and the one I'm using are both using IIS.

    This other person reports that in their PHP scripts when tested with Apache,
    form variable sent via the POST method are not "coming through." (This is
    even using the "long method" of specifying them as $HTTP_POST_VARS['x'].)
    These same scripts work fine on the the IIS machine (the POST variable come
    through).

    I've looked online to see if I can find out if anything special must be
    specified in the Apache configuration to enable the POST method, and
    although I found other people posting similar problems, I saw no reference
    to a solution.

    Can anyone tell me what must be done to get this to work as it should with
    Apache?

    Thanks.

    Tony


  • steven mestdagh

    #2
    Re: Apache/PHP Post Variables

    In comp.lang.php Tony <nospam@pittare se.com> wrote:[color=blue]
    > This other person reports that in their PHP scripts when tested with Apache,
    > form variable sent via the POST method are not "coming through." (This is
    > even using the "long method" of specifying them as $HTTP_POST_VARS['x'].)
    > These same scripts work fine on the the IIS machine (the POST variable come
    > through).[/color]

    probably there is nothing wrong with your apache setup.
    try $_POST['x'] instead of $HTTP_POST_VARS['x'] .
    $_POST is a superglobal array, whereas $HTTP_POST_VARS is not.
    for more information, see


    if this doesn't solve your problem...
    which version of PHP are you using? have you inspected the apache log
    files for errors?

    regards,
    steven.

    Comment

    • Joshua Beall

      #3
      Re: Apache/PHP Post Variables

      "steven mestdagh" <steven.mestdag h@esat.kuleuven .REMOVE-THIS.ac.be> wrote in
      message news:1076807327 .859984@seven.k ulnet.kuleuven. ac.be...[color=blue]
      > In comp.lang.php Tony <nospam@pittare se.com> wrote:[color=green]
      > > This other person reports that in their PHP scripts when tested with[/color][/color]
      Apache,[color=blue][color=green]
      > > form variable sent via the POST method are not "coming through." (This[/color][/color]
      is[color=blue][color=green]
      > > even using the "long method" of specifying them as[/color][/color]
      $HTTP_POST_VARS['x'].)[color=blue][color=green]
      > > These same scripts work fine on the the IIS machine (the POST variable[/color][/color]
      come[color=blue][color=green]
      > > through).[/color]
      >
      > probably there is nothing wrong with your apache setup.
      > try $_POST['x'] instead of $HTTP_POST_VARS['x'] .
      > $_POST is a superglobal array, whereas $HTTP_POST_VARS is not.[/color]

      I would also suggest print_r($GLOBAL S), and see if that reveals anything
      interesting.


      Comment

      • Dan Tripp

        #4
        Re: Apache/PHP Post Variables

        Joshua Beall wrote:
        [color=blue]
        > "steven mestdagh" <steven.mestdag h@esat.kuleuven .REMOVE-THIS.ac.be> wrote in
        > message news:1076807327 .859984@seven.k ulnet.kuleuven. ac.be...
        >[color=green]
        >>In comp.lang.php Tony <nospam@pittare se.com> wrote:
        >>[color=darkred]
        >>>This other person reports that in their PHP scripts when tested with[/color][/color]
        >
        > Apache,
        >[color=green][color=darkred]
        >>>form variable sent via the POST method are not "coming through." (This[/color][/color]
        >
        > is
        >[color=green][color=darkred]
        >>>even using the "long method" of specifying them as[/color][/color]
        >
        > $HTTP_POST_VARS['x'].)
        >[color=green][color=darkred]
        >>>These same scripts work fine on the the IIS machine (the POST variable[/color][/color]
        >
        > come
        >[color=green][color=darkred]
        >>>through).[/color]
        >>
        >>probably there is nothing wrong with your apache setup.
        >>try $_POST['x'] instead of $HTTP_POST_VARS['x'] .
        >>$_POST is a superglobal array, whereas $HTTP_POST_VARS is not.[/color]
        >
        >
        > I would also suggest print_r($GLOBAL S), and see if that reveals anything
        > interesting.
        >
        >[/color]

        This sounds like a register_global s problem. Check the PHP.ini file on
        the dev machine, and it'll probably show register_global s = off.

        Before you change it to "on" however, take a look at:


        I'd go so far as to recommend that your two IIS boxes should probably
        have register_global s turned off.

        Regards,

        - Dan

        Comment

        • Tony

          #5
          Re: Apache/PHP Post Variables--FOLLOWUP

          "Dan Tripp" <thisIsNot@MyEM ailAddress.com> wrote in message news:_oOXb.2562 3[color=blue]
          > This sounds like a register_global s problem. Check the PHP.ini file on
          > the dev machine, and it'll probably show register_global s = off.
          >
          > Before you change it to "on" however, take a look at:
          > http://www.php.net/register_globals
          >[/color]

          Thanks to all those who posted info. Prior to running into this problem I
          wasn't well informed about the issues related to the globals. I appreciate
          the replies.

          Unfortunately, the book I've been using as my primary reference (PHP and
          MySQL Web Development by Welling and Thomson) uses $HTTP_POST_VARS in
          examples and doesn't explain why this might be a bad thing. (That's 1 of
          about 5 problems or errors I've found in my use of this book so far.)

          Thanks for all the great info provided.

          Tony


          Comment

          • Phillip Parr

            #6
            Re: Apache/PHP Post Variables--FOLLOWUP

            I just use the $_REQUEST['variable'] thingy for forms, works for me!


            "Tony" <nospam@pittare se.com> wrote in message
            news:c0odb4$edc @library2.airne ws.net...[color=blue]
            > "Dan Tripp" <thisIsNot@MyEM ailAddress.com> wrote in message[/color]
            news:_oOXb.2562 3[color=blue][color=green]
            > > This sounds like a register_global s problem. Check the PHP.ini file on
            > > the dev machine, and it'll probably show register_global s = off.
            > >
            > > Before you change it to "on" however, take a look at:
            > > http://www.php.net/register_globals
            > >[/color]
            >
            > Thanks to all those who posted info. Prior to running into this problem I
            > wasn't well informed about the issues related to the globals. I[/color]
            appreciate[color=blue]
            > the replies.
            >
            > Unfortunately, the book I've been using as my primary reference (PHP and
            > MySQL Web Development by Welling and Thomson) uses $HTTP_POST_VARS in
            > examples and doesn't explain why this might be a bad thing. (That's 1 of
            > about 5 problems or errors I've found in my use of this book so far.)
            >
            > Thanks for all the great info provided.
            >
            > Tony
            >
            >[/color]


            Comment

            • Eric Bohlman

              #7
              Re: Apache/PHP Post Variables--FOLLOWUP

              "Phillip Parr" <nomail@here.co m> wrote in
              news:jx5Yb.2579 8$ul3.5721@news-binary.blueyond er.co.uk:
              [color=blue]
              > I just use the $_REQUEST['variable'] thingy for forms, works for me![/color]

              The problem with $_REQUEST is that what goes into it is determined by
              php.ini settings, so it can create portability problems. Also, depending
              on those settings, cookie names and environment-variable names wind up
              sharing the same namespace as GET and POST parameter names, and may in fact
              overwrite them. So it's really appropriate only when you have complete
              control over the environment in which PHP is running and don't expect the
              code to be moved to any other environment.

              Comment

              • Joshua Beall

                #8
                Re: Apache/PHP Post Variables--FOLLOWUP

                "Eric Bohlman" <ebohlman@earth link.net> wrote in message
                news:Xns949175C 6769F6ebohlmano msdevcom@130.13 3.1.4...[color=blue]
                > "Phillip Parr" <nomail@here.co m> wrote in
                > news:jx5Yb.2579 8$ul3.5721@news-binary.blueyond er.co.uk:
                >
                >
                > The problem with $_REQUEST is...[/color]
                <snip>

                Let me summarize for you: Do not use $_REQUEST. It is bad idea. Use $_GET,
                $_POST, or $_COOKIE.

                ;-)

                -jb


                Comment

                • Phillip Parr

                  #9
                  Re: Apache/PHP Post Variables--FOLLOWUP

                  Ok then. You spoilin all my fun!

                  "Joshua Beall" <jbeall@donotsp am.remove.me.he raldic.us> wrote in message
                  news:5IoYb.3585 1$1S1.19656@nwr ddc01.gnilink.n et...[color=blue]
                  > "Eric Bohlman" <ebohlman@earth link.net> wrote in message
                  > news:Xns949175C 6769F6ebohlmano msdevcom@130.13 3.1.4...[color=green]
                  > > "Phillip Parr" <nomail@here.co m> wrote in
                  > > news:jx5Yb.2579 8$ul3.5721@news-binary.blueyond er.co.uk:
                  > >
                  > >
                  > > The problem with $_REQUEST is...[/color]
                  > <snip>
                  >
                  > Let me summarize for you: Do not use $_REQUEST. It is bad idea. Use[/color]
                  $_GET,[color=blue]
                  > $_POST, or $_COOKIE.
                  >
                  > ;-)
                  >
                  > -jb
                  >
                  >[/color]


                  Comment

                  Working...