FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » $_POST not set on 404
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
$_POST not set on 404 [message #173050] Fri, 18 March 2011 20:56 Go to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
I'm setting up a server that is completely resource-based, so every
valid request is going to be a 404-not-found as far as apache is
concerned. That's fine, it's expected and handled.

What is not fine is that when it's a form with action=POST, because
the specific resource is 404-not-found, PHP does not set the $_POST
variable.

Anybody know a way to get the information from PHP?

--
no aluminum siding offers today
Re: $_POST not set on 404 [message #173052 is a reply to message #173050] Sat, 19 March 2011 00:33 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/18/2011 4:56 PM, crankypuss wrote:
> I'm setting up a server that is completely resource-based, so every
> valid request is going to be a 404-not-found as far as apache is
> concerned. That's fine, it's expected and handled.
>
> What is not fine is that when it's a form with action=POST, because
> the specific resource is 404-not-found, PHP does not set the $_POST
> variable.
>
> Anybody know a way to get the information from PHP?
>

PHP isn't doing this - your web server is.

If you check $_SERVER['REQUEST_METHOD'] you should find PHP is receiving
a $_GET request. That's what Apache does when it redirects for a 404.
So, since PHP does not receive a $_POST request, there is no $_POST data
to process.

Your entire setup seems screwy to me. 404 should not be "expected",
whether you're using PHP or something else. It should be an error
condition.

What exactly are you trying to do? There must be a better way.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: $_POST not set on 404 [message #173053 is a reply to message #173052] Sat, 19 March 2011 07:46 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 3/18/2011 4:56 PM, crankypuss wrote:
>> I'm setting up a server that is completely resource-based, so every
>> valid request is going to be a 404-not-found as far as apache is
>> concerned. That's fine, it's expected and handled.
>>
>> What is not fine is that when it's a form with action=POST, because
>> the specific resource is 404-not-found, PHP does not set the $_POST
>> variable.
>>
>> Anybody know a way to get the information from PHP?
>>
>
> PHP isn't doing this - your web server is.
>
> If you check $_SERVER['REQUEST_METHOD'] you should find PHP is receiving
> a $_GET request. That's what Apache does when it redirects for a 404.

So it's an apache issue, eh? Yes, the request_method is set to "GET"
when my code receives control, something else (redirect_method or
somesuch) is set to POST.

> So, since PHP does not receive a $_POST request, there is no $_POST data
> to process.

At least that makes some sense, thanks; maybe I can fish around and
dig it up knowing who last had it. Any idea whether apache kept the
data that came as a result of the POST action, or did it just throw it
on the floor?

> Your entire setup seems screwy to me. 404 should not be "expected",
> whether you're using PHP or something else. It should be an error
> condition.
>
> What exactly are you trying to do? There must be a better way.

Answered in aww. Thanks for the "look at apache data" clue, I'll
check it out.

--
no aluminum siding offers today
Re: $_POST not set on 404 [message #173054 is a reply to message #173053] Sat, 19 March 2011 11:19 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sat, 19 Mar 2011 01:46:08 -0600, crankypuss wrote:

>> So, since PHP does not receive a $_POST request, there is no $_POST data
>> to process.

> At least that makes some sense, thanks; maybe I can fish around and dig
> it up knowing who last had it. Any idea whether apache kept the data
> that came as a result of the POST action, or did it just throw it on the
> floor?

If it can't find the form handler, I expect it drops it on the floor.

Rgds

Denis McMahon
Re: $_POST not set on 404 [message #173055 is a reply to message #173054] Sat, 19 March 2011 11:54 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
Denis McMahon <denis(dot)m(dot)f(dot)mcmahon(at)gmail(dot)com> wrote:

> On Sat, 19 Mar 2011 01:46:08 -0600, crankypuss wrote:
>
>>> So, since PHP does not receive a $_POST request, there is no $_POST data
>>> to process.
>
>> At least that makes some sense, thanks; maybe I can fish around and dig
>> it up knowing who last had it. Any idea whether apache kept the data
>> that came as a result of the POST action, or did it just throw it on the
>> floor?
>
> If it can't find the form handler, I expect it drops it on the floor.
>
> Rgds
>
> Denis McMahon

That's how it's looking to me. I've found dozens of people asking how
to get the POST data on a 404 but no answers yet.

Sure, I can make it work, but I really don't want to resort to what it
appears it would take, ie special-casing all form action urls to be
different from link urls to prevent 404, then restoring the uri from
saved data. That's just fugly.

Current guess is that without a new flavor of ErrorDocument directive
it's hopeless, but I'm still looking, clues more than welcome.

Is there a good newsgroup for apache? Only one I saw was
alt.apache.configuration, is that The Place?

--
no aluminum siding offers today
Re: $_POST not set on 404 [message #173056 is a reply to message #173055] Sat, 19 March 2011 12:14 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/19/2011 7:54 AM, crankypuss wrote:
> Denis McMahon<denis(dot)m(dot)f(dot)mcmahon(at)gmail(dot)com> wrote:
>
>> On Sat, 19 Mar 2011 01:46:08 -0600, crankypuss wrote:
>>
>>>> So, since PHP does not receive a $_POST request, there is no $_POST data
>>>> to process.
>>
>>> At least that makes some sense, thanks; maybe I can fish around and dig
>>> it up knowing who last had it. Any idea whether apache kept the data
>>> that came as a result of the POST action, or did it just throw it on the
>>> floor?
>>
>> If it can't find the form handler, I expect it drops it on the floor.
>>
>> Rgds
>>
>> Denis McMahon
>
> That's how it's looking to me. I've found dozens of people asking how
> to get the POST data on a 404 but no answers yet.
>
> Sure, I can make it work, but I really don't want to resort to what it
> appears it would take, ie special-casing all form action urls to be
> different from link urls to prevent 404, then restoring the uri from
> saved data. That's just fugly.
>
> Current guess is that without a new flavor of ErrorDocument directive
> it's hopeless, but I'm still looking, clues more than welcome.
>
> Is there a good newsgroup for apache? Only one I saw was
> alt.apache.configuration, is that The Place?
>

Yes, that's the place to go.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: $_POST not set on 404 [message #173057 is a reply to message #173050] Sat, 19 March 2011 12:18 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
crankypuss <no(at)email(dot)thanks> wrote:

> I'm setting up a server that is completely resource-based, so every
> valid request is going to be a 404-not-found as far as apache is
> concerned. That's fine, it's expected and handled.
>
> What is not fine is that when it's a form with action=POST, because
> the specific resource is 404-not-found, PHP does not set the $_POST
> variable.
>
> Anybody know a way to get the information from PHP?

It appears that I am far from the first to encounter this issue, and
that the easiest solution involves mod_rewrite. Here is the info that
seems most pertinent in case anyone is interested:

http://www.brainonfire.net/blog/apache-pitfall-errordocument-post/

Looks as if I need to go off and learn about mod_rewrite now (and
ignorance was *so* blissful!). Thanks all.

--
no aluminum siding offers today
Re: $_POST not set on 404 [message #173058 is a reply to message #173056] Sat, 19 March 2011 12:31 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 3/19/2011 7:54 AM, crankypuss wrote:
>> Denis McMahon<denis(dot)m(dot)f(dot)mcmahon(at)gmail(dot)com> wrote:
>>
>>> On Sat, 19 Mar 2011 01:46:08 -0600, crankypuss wrote:
>>>
>>>> > So, since PHP does not receive a $_POST request, there is no $_POST data
>>>> > to process.
>>>
>>>> At least that makes some sense, thanks; maybe I can fish around and dig
>>>> it up knowing who last had it. Any idea whether apache kept the data
>>>> that came as a result of the POST action, or did it just throw it on the
>>>> floor?
>>>
>>> If it can't find the form handler, I expect it drops it on the floor.
>>>
>>> Rgds
>>>
>>> Denis McMahon
>>
>> That's how it's looking to me. I've found dozens of people asking how
>> to get the POST data on a 404 but no answers yet.
>>
>> Sure, I can make it work, but I really don't want to resort to what it
>> appears it would take, ie special-casing all form action urls to be
>> different from link urls to prevent 404, then restoring the uri from
>> saved data. That's just fugly.
>>
>> Current guess is that without a new flavor of ErrorDocument directive
>> it's hopeless, but I'm still looking, clues more than welcome.
>>
>> Is there a good newsgroup for apache? Only one I saw was
>> alt.apache.configuration, is that The Place?
>>
>
> Yes, that's the place to go.

Thanks, I've subscribed to it, but it doesn't look like I have a
question to post anymore (see my other post here).

--
no aluminum siding offers today
Re: $_POST not set on 404 [message #173059 is a reply to message #173057] Sat, 19 March 2011 13:26 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/19/2011 8:18 AM, crankypuss wrote:
> crankypuss<no(at)email(dot)thanks> wrote:
>
>> I'm setting up a server that is completely resource-based, so every
>> valid request is going to be a 404-not-found as far as apache is
>> concerned. That's fine, it's expected and handled.
>>
>> What is not fine is that when it's a form with action=POST, because
>> the specific resource is 404-not-found, PHP does not set the $_POST
>> variable.
>>
>> Anybody know a way to get the information from PHP?
>
> It appears that I am far from the first to encounter this issue, and
> that the easiest solution involves mod_rewrite. Here is the info that
> seems most pertinent in case anyone is interested:
>
> http://www.brainonfire.net/blog/apache-pitfall-errordocument-post/
>
> Looks as if I need to go off and learn about mod_rewrite now (and
> ignorance was *so* blissful!). Thanks all.
>

It's not the "easiest answer" - it's the "more correct" answer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: $_POST not set on 404 [message #173060 is a reply to message #173059] Sat, 19 March 2011 13:35 Go to previous message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 3/19/2011 8:18 AM, crankypuss wrote:
>> crankypuss<no(at)email(dot)thanks> wrote:
>>
>>> I'm setting up a server that is completely resource-based, so every
>>> valid request is going to be a 404-not-found as far as apache is
>>> concerned. That's fine, it's expected and handled.
>>>
>>> What is not fine is that when it's a form with action=POST, because
>>> the specific resource is 404-not-found, PHP does not set the $_POST
>>> variable.
>>>
>>> Anybody know a way to get the information from PHP?
>>
>> It appears that I am far from the first to encounter this issue, and
>> that the easiest solution involves mod_rewrite. Here is the info that
>> seems most pertinent in case anyone is interested:
>>
>> http://www.brainonfire.net/blog/apache-pitfall-errordocument-post/
>>
>> Looks as if I need to go off and learn about mod_rewrite now (and
>> ignorance was *so* blissful!). Thanks all.
>>
>
> It's not the "easiest answer" - it's the "more correct" answer.

Let's not get into philosophical arguments over whether "more correct"
involves using an apache extension module, rewriting apache, or some
other approach.

All working answers are correct answers, by definition; beyond that
it's a matter of how solid, how costly, and how elegant a solution is.

--
no aluminum siding offers today
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Pipe the content of a variable to a process
Next Topic: Confused about a MySQL Statement
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 12:24:05 GMT 2024

Total time taken to generate the page: 0.04894 seconds