After an OS update, "bigger" HTTP requests are no longer handled correctly by the web server/PHP/MediaWiki. Wiki article content is truncated after about 6K characters and MediaWiki reports a loss of session.

Symptoms: I first recognized the error with my formerly working installation of MediaWiki (PHP). When I edit an article and its size grows bigger than approx. 6k characters, the article text is truncated and the MediaWiki rejects to save the new text but reports a lost session error. Smaller articles are not affected.

Question: Is this possibly a bug in PHP? Should I file a bug report? Or am I doing something wrong? Is something misconfigured?

Context: At home, I recently updated my raspbian LAMP server from wheezy to jessie. It all worked well before.

  1. Operating system: Raspbian jessie (formerly wheezi) on a Raspberry Pi.
  2. Apache 2.4.
  3. phpinfo() shows no indication of suhosin, which is sometimes reported to cause problems with larger http requests. Also, other PHP parameters that are sometimes mentioned as relevant on the web are unsuspicious: PHP Version 5.6.24-0+deb8u1. max_input_time=60, max_execution_time=30, post_max_size=8M

What I tried so far:

  1. Other PHP program: To investigate further, I uploaded files through a simple PHP file upload script. Similar problem; file upload does not work. (For your reference, the code of the upload script was taken from here: http://www.codingcage.com/2014/12/simple-file-uploading-with-php.html The script uses simple form data, no Ajax, no JSON, ...)
  2. Larger file causes split: Moreover, larger http file upload requests (using files of several hundred KB) are seemingly split into two requests. The apache access log file shows (remember this is actually only a single request from the browser):
    • ... - - [05/Aug/2016:10:52:38 +0200] "POST /simpleupload.php HTTP/1.1" 200 85689 "https://.../simpleupload.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"
    • ... - - [05/Aug/2016:10:52:38 +0200] "\xb4W\xcd\xff" 400 557 "-" "-" -
  3. Other browsers: The behavior can be replicated with different browsers: Firefox on Linux, Firefox 38 on Windows, and elinks browser on same machine.
  4. Eliminate network problems: I used elinks to access the webserver on localhost. Same problems in MediaWiki and the PHP file upload script.
  5. Increased Log level: Increasing the Apache LogLevel to debug does not bring up any new information during request handling.
  6. Error does not occur with Perl: The problem does not occur with a different file upload script written in Perl. File upload works properly. So, it does not seem to be a problem with OS, Apache, Browser, ...

Remarks: This is my attempt to rephrase my locked/on-hold question https://unix.stackexchange.com/questions/301444/small-http-requests-get-truncated, which I cannot edit anymore.

  • 1
    LAMP usage is offtopic there, as it's a all-in-one bundle that is useful to run a lab, but not in production's use. – yagmoth555 Aug 8 '16 at 15:54

In my case, I followed the instruction from https://wiki.debian.org/LaMp to "aptitude install php5 php5-mysql libapache2-mod-php5" which replaced the installed libapache2-mod-php5filter with libapache2-mod-php5. This fixed my problem.

Here is a link to the explanation of the difference betweeen the two packages: apache2 and php5: module or filter. However, I do not see why in my case the filter should have caused the strange problem. But, anyhow, it's fixed now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.