$_POST acting strange on Apache/2.2.19 PHP 5.3.6-12

Hi everyone!

I made a post form and I made sure to validate and sanitize the input. Whenever I leave a mandatory field empty my code runs fine and I get a warning for that specific field (css class).

The problem is when I correctly fill out the form and submit it. I can’t figure out why all the post data is missing. And by missing I mean:

var_dump($_POST); // at the beginning of the PHP file
array(0) { }

Have any of you encountered this situation?

Linux 2.6.39-2-686-pae #1 SMP Wed Jun 8 11:33:14 UTC 2011 i686 GNU/Linux

Server version: Apache/2.2.19 (Debian)
Server built: May 22 2011 08:32:52

PHP 5.3.6-12 with Suhosin-Patch (cli) (built: Jun 15 2011 15:47:56)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

Is your validation code in PHP? $_POST can’t simultaneously be populated (you’re validating it) and empty… so the situation is not as you’re giving it. Post code.

In the meantime I tested the code on a live Ubuntu 10.04 server and it runs just as expected - flawless -, which is why I feel there’s no need to post any code (at this point).

The machine giving me this trouble is my personal PC. I have a few years of experience with servers, xAMP, PHP&MySQL so this very unlikely a slip-up on my part but rather some strange bug. I hoped someone might have ran into the same problem.

mod_security rules? If you have it enabled, they should be writing something to the access or audit log.

No mod_security. Only the well known Suhosin patch which runs on the live server as well.

# ls -l /etc/apache2/mods-enabled/*.load
lrwxrwxrwx 1 root root 28 iun 20 21:36 /etc/apache2/mods-enabled/alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root 33 iun 20 21:36 /etc/apache2/mods-enabled/auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root 33 iun 20 21:36 /etc/apache2/mods-enabled/authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root 36 iun 20 21:36 /etc/apache2/mods-enabled/authz_default.load -> ../mods-available/authz_default.load
lrwxrwxrwx 1 root root 38 iun 20 21:36 /etc/apache2/mods-enabled/authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root 33 iun 20 21:36 /etc/apache2/mods-enabled/authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root 33 iun 20 21:36 /etc/apache2/mods-enabled/authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root 32 iun 20 21:36 /etc/apache2/mods-enabled/autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root 26 iun 20 21:38 /etc/apache2/mods-enabled/cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root 30 iun 20 21:36 /etc/apache2/mods-enabled/deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root 26 iun 20 21:36 /etc/apache2/mods-enabled/dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root 26 iun 20 21:36 /etc/apache2/mods-enabled/env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root 27 iun 20 21:36 /etc/apache2/mods-enabled/mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root 34 iun 20 21:36 /etc/apache2/mods-enabled/negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root 27 iun 20 21:39 /etc/apache2/mods-enabled/php5.load -> ../mods-available/php5.load
lrwxrwxrwx 1 root root 33 iun 20 21:36 /etc/apache2/mods-enabled/reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root 30 iun 27 16:12 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load
lrwxrwxrwx 1 root root 31 iun 20 21:36 /etc/apache2/mods-enabled/setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root 29 iun 20 21:36 /etc/apache2/mods-enabled/status.load -> ../mods-available/status.load

I have no other logs than access_log and error_log and the latter doesn’t have any info related to this weirdness.

Well… There is this message in error_log after I try to $_POST a fully completed form:

[Wed Jul 08:52:55 2011] [info] [client 1.2.3.4] Request body read timeout

So far I didn’t anything helpful on the web. This is the behaviour:

  1. I send the POST data
  2. The web server does something for quite a few seconds (probably between 20-30 seconds)
  3. The browser page reloads with no $_POST data and reacting accordingly
  4. The web server logs the “Request body read timeout” message