2

I have a plain ajax request being initiated by jQuery to a PHP script:

$.ajax({
  url:"script.php",
  data: data,
  type: "POST"
  // error & success handlers here
});

If the data (could be JSON, could be a binary file), exceed a few hundred characters in length, the POST request never completes, it just hangs there. No errors in apache log or JS console, no other indication as to what might be going on.

Fiddling with php.ini post_max_data and other settings did not yield any results and all settings I could think of are set to very permissive values.

I'm running an Ubuntu 14.04 server with Apache 2.4 and PHP 5.5.9.

What am I missing?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208

1 Answers1

2

Have you checked your PHP configuration regarding your request length? There are several parameters controlling the allowed size of a request, I'll include the most important ones here (straight from php.ini with references).

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 10M

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 1000

This one might need to be increased if you have a highly nested data structure in your post variables (rather unlikely)

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
max_input_nesting_level = 64

Hope this helps,

Kind regards and happy coding!

4levels
  • 123
  • 5