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

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.

Answers


Could it be not the size related of the post, but how long the line is before a new line. If they use the Moodle WYSIWYG view the html would just get put into one line with no breaks. If you go into html and hit return around every 1000 characters does it work?


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).


What is the enctype of the form? Could be that it limits the ammount of data send through the form.

You might also want to check the incoming raw $_POST data with:

file_get_contents('php://input');

To make sure their is actually data send. Got these suggestions here.


It sounds like an Apache or Apache/PHP integration problem. If $_POST is empty it would hint that the http server is not giving the POST information to PHP. If I were you I'd investigate the Apache configuration.


This is obvious, but did you /etc/init.d/apache2 restart ?

Also, the error_log file should show some information about whether the post size exceeded the set limit. Consider increasing your verbosity for troubleshooting the issue


Need Your Help

Plotting density object with ggplot2

r plot ggplot2

I have this object "dens" computed with the R "Sparr" package that I would like to plot using ggplot2

RIA: "Use local IIS Web server"

wcf silverlight iis ria

I know I've had this problem when I started working with Silverlight, but I can't for the life of me remember how to fix it.