问题
I've been struggling with a problem where multiple POST requests seemingly crash the server (site won't load, no requests allowed) for a couple minutes. GET requests do not cause this issue.
This isn't a code issue, the code works fine
It's likely something with my server config.
Example of Frontend JS:
$(".searchbox").keyup(function() {
var data = $('.searchbox').val();
$.ajax({
url: "../assets/php/graphenesearch.php",
method: "POST",
data: {
data: data
},
async: true,
dataType: "html"
}).done(function(msg) {
$(".search-output").html(msg);
});
});
Example of Backend PHP:
$input = $_POST['data'];
echo $input;
Even with this simple of code, I'm having issues. So it's clearly with the number of requests and not the amount of data being passed.
The server allows ~40 requests, but then stops functioning.
I receive this error:
POST http://www.graphenesearch.co/assets/php/graphenesearch.php net::ERR_EMPTY_RESPONSE
It's probably something obvious right? Server config?
回答1:
Giving you a detailed answer if there is any problem with request handling in server side there will be several problems
Server Network ( You don't have any problem with you code , sometime some data center face internet connection problem . DDOS attacks on data center can also cause damage on processing request )
Getting too much request ( Every web server have some limitation because on server can not handle too much request . In Low quality shared hosting or Low quality OpenCV hosting you'll face this kind of problem . Even I faced this kind of a problem)
PHP Configuration error , you'r php might not configured correctly . maybe that is causing all damage . Open the php log file to check there. after configuration fix PLEASE RESTART YOUR SERVER.
来源:https://stackoverflow.com/questions/34986709/i-receive-no-data-from-server-after-multiple-post-requests