httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kvnsm...@cs.byu.edu
Subject [users@httpd] Why Can't I Get Apache to Post?
Date Thu, 26 Jul 2007 17:24:44 GMT
I did a google for this topic but couldn't find anything that had to
do with posting.  I read through the FAQ and couldn't find anything
that had to do with posting.  I tried inspection and experimentation
and that didn't work.  I even asked our resident expert on Apache, and
he couldn't help me either.  In fact he asked that I let him know of
any responses I get to this article because he wants to know the an-
swer too.  I couldn't find anything relevant in the archive for this
group.

My company has a bunch of PHP files that are currently working on one
of our machines with webserver Apache.  We moved those files over to
my local machine with webserver Apache.  When I take my browser to the
URL corresponding to my machine I get a login prompt asking me for my
username and password.  The PHP code gets executed to a place that
says:

     if ( $_SERVER[ "REQUEST_METHOD" ] == "POST" ) {
       // Redirect user depending upon login
       if( $User->login( $txtUsername, $txtPassword ) ) {
         if ( $User->simple_interface == "1")
           header ("Location: simple_interface.php");
         else
           header( "Location: view_list.php" );
       } else {
         header
           ( "Location: .." . $domain
           . ($_GET[ "gid" ] ? "?gid=".$_GET[ "gid" ] : "" ));
       } // end if
     } else if( isset( $lfu ) && isset( $lfp ) ) {
       // Redirect user depending upon login
       if( $User->login( $lfu, $lfp ) ) {
         if ( $User->simple_interface == "1")
           header ("Location: simple_interface.php");
         else
           header( "Location: view_list.php" );
       } else {
         header
           ( "Location: .." . $domain
           . ($_GET[ "gid" ] ? "?gid=".$_GET[ "gid" ] : "" ));
       } // end if
     } // end if

What happens on the machine where this code is working is that
<$_SERVER[ "REQUEST_METHOD" ]> evaluates to "POST" so the first branch
of the outer <if> statement gets executed, and the user is logged in.
But on my machine <$_SERVER[ "REQUEST_METHOD" ]> evaluates to "GET",
and one of <lfu> or <lfp> are undefined, so none of this code gets ex-
ecuted at all.

Does anyone on this newsgroup know why Apache doesn't post at this
point?  Can Apache handle server side variables?  Is there a chance
that that's what's messing me up?  Am I providing enough information
to answer these questions, or do I need to say more?

I did a search on all files in the relevant directories that refer-
ence <REQUEST_METHOD> OR <$_SERVER[ "REQUEST_METHOD"]> to see where it
gets set to "POST", but there isn't any, so it would appear to me that
it must get set outside of the actual PHP code, which doesn't help me
much because I don't understand how variables get set outside of PHP
code.

What's really confusing me is that both webservers are Apache.  The
only differences between the "httpd.conf" files for the two machines
is the groups of <VirtualHost ...> ... </VirtualHost> sections down at
the bottom of each.

You can see the snippet of code whose performance I don't understand
up above, but I'm including the entire file it came from as an attach-
ment.  I've modified the code up above slightly to make it fit in
eighty columns.

Any help you can give me on this would be greatly appreciated.

                                ---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

Mime
View raw message