Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is _POST sometimes empty when a textarea is posted in PHP

Tags:

php

apache2

PHP 4.4 and PHP 5.2.3 under Apache 2.2.4 on ubuntu.

I am running Moodle 1.5.3 and have recently had a problem when updating a course. The $_POST variable is empty but only if a lot of text was entered into the textarea on the form. If only a short text is entered it works fine.

I have increased the post_max_size from 8M to 200M and increased the memory_limit to 256M but this has not helped. I have doubled the LimitRequestFieldSize and LimitRequestLine to 16380 and set LimitRequestBody to 0 with no improvement.

I have googled for an answer but have been unable to find one.

HTTP Headers on firefox shows the content size of 3816 with the correct data, so its just not getting to $_POST.

The system was running fine until a few weeks ago. The only change was to /etc/hosts to correct a HELO issue with the exim4 email server.

I can replicate the issue on a development machine that has exim4 not running so I think it is just coincidence.

Thanks for your assistance.

like image 768
Puzzled Avatar asked Oct 15 '22 18:10

Puzzled


1 Answers

I don't know enough to really provide a useful answer so the following is more a well-educated guess (at least I hope so).

First, you should debug the entire request, either by access_log or for example through firebug. (Good to have Firebug anyway.) To me your problem sounds like a redirect happens in between. I give you an example:

Assume this is your structure:

/form.php
/directory/index.php

This is your form:

<form action="/directory" method="post">
...
</form>

Problem in this case is, that even though /directory is a valid url, Apache will redirect you one more time to /directory/, thus you are loosing your payload (what is supposed to be in $_POST).

like image 92
Till Avatar answered Oct 21 '22 03:10

Till