$_POST empty

I have a page that posts form values to another page that worked in January, and doesn’t work anymore. It hasn’t been used since January, now it needs to be used again. No code had changed, and a search led me to believe that I needed to change my $HTTP_POST_VARS to $_POST. I did this, and now the $_POST array comes empty.

What’s really strange to me is that if I output $_REQUEST, I get everything that I would expect, all my $_GET, $_POST, and $_COOKIE, as the documentation suggests. But then I output each of $_GET, $_POST, and $_COOKIE separately, and the $_POST is empty. The other two are correct.

For now I will use $_REQUEST since it has all my posted values. Is there a setting that I need to change to make the $_POST variable work?

First things first - let’s check the value of $_SERVER[‘REQUEST_METHOD’] because if it is not ‘POST’ we should expect $_POST to be empty.

Let’s see.


If we don’t post anything we are left with


Doesn’t seem strange at all.

Customer since 2000 :cool: openvein.org

Perhaps I was not clear.

I shall state it another way: If I add the sizes of each array: $_GET + $_POST + $_COOKIE, the sum is 2+0+5=7.

But if I look at the size of the $_REQUEST array, it is 15, and includes all 8 items I post on the form.

So, as you can see, $_GET + $_POST + $_COOKIE != $_REQUEST, which is why I found it strange, and still do.

And yes, the value of $_SERVER[‘REQUEST_METHOD’] is ‘POST’.

I will continue to ignore the $_POST variable since it doesn’t work for me at this time.

$_POST should work fine with the default install of PHP 5 by DreamHost. Perhaps you can figure out the what the problem is later when you can reduce your code to a testcase.

Customer since 2000 :cool: openvein.org

I’m aware of how $_POST should work, via a simple Google search. So that isn’t much help. A testcase is what I started with of course. I posted my problem on another PHP board and have received several much more helpful leads that I’ll look into in the morning. It looks like nothing much will come from this thread. Thanks anyway for letting me know how $_POST should work.

Had similar problem, here is my solution


Did you ever find a solution to this? I am having the same issue…I ran the exact same request to the exact same php file at a different host and $_POST is populated. However, on DreamHost it is empty.

I figured out my problem. It was a bit different, but I will post in case it helps someone else.

I was calling a php endpoint from an android app using httpurlconnection. I needed to call setFixedLengthStreamingMode instead of setChunkedStreamingMode. This didn’t need to be done my old host, but something in dreamhost’s php config must have required it.