Ajax Json对PHP7和IIS 7的限制

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ajax Json对PHP7和IIS 7的限制相关的知识,希望对你有一定的参考价值。

我希望有人可以提供一些帮助。我们有一个php脚本,可以生成加载到HighCharts中的JSON日期。由于某种原因,JSON响应的长度影响它仅在生产服务器上工作。我们得到一个JSON意外的内容结束,并且响应缺少JSON响应的最终字符。

如果我们尝试打印365天它失败但320天工作(内容较少),所以我认为这与POST响应的长度有关。我已经设置了所有的PHP max_input_vars,POST大小和最大上传大小等,但它没有修复。我在这里缺少一个IIS7设置吗?

示例JSON响应:

[{"name":"D","data":[{"date":"2016, 11, 26","value":0},{"date":"2016, 11, 27","value":0},{"date":"2016, 11, 28","value":83},{"date":"2016, 11, 29","value":66},{"date":"2016, 11, 30","value":92},{"date":"2016, 12, 01","value":78},{"date":"2016, 12, 02","value":78},{"date":"2016, 12, 03","value":0},{"date":"2016, 12, 04","value":0},{"date":"2016, 12, 05","value":77},{"date":"2016, 12, 06","value":88},{"date":"2016, 12, 07","value":67},{"date":"2016, 12, 08","value":116},{"date":"2016, 12, 09","value":94},{"date":"2016, 12, 10","value":0},{"date":"2016, 12, 11","value":0},{"date":"2016, 12, 12","value":111},{"date":"2016, 12, 13","value":80},{"date":"2016, 12, 14","value":75},{"date":"2016, 12, 15","value":101},{"date":"2016, 12, 16","value":57},{"date":"2016, 12, 17","value":0},{"date":"2016, 12, 18","value":0},{"date":"2016, 12, 19","value":73},{"date":"2016, 12, 20","value":35},{"date":"2016, 12, 21","value":25},{"date":"2016, 12, 22","value":0},{"date":"2016, 12, 23","value":0},{"date":"2016, 12, 24","value":0},{"date":"2016, 12, 25","value":0},{"date":"2016, 12, 26","value":0},{"date":"2016, 12, 27","value":0},{"date":"2016, 12, 28","value":0},{"date":"2016, 12, 29","value":0},{"date":"2016, 12, 30","value":0},{"date":"2016, 12, 31","value":0},{"date":"2017, 01, 01","value":0},{"date":"2017, 01, 02","value":0},{"date":"2017, 01, 03","value":52},{"date":"2017, 01, 04","value":19},{"date":"2017, 01, 05","value":17},{"date":"2017, 01, 06","value":21},{"date":"2017, 01, 07","value":0},{"date":"2017, 01, 08","value":0},{"date":"2017, 01, 09","value":29},{"date":"2017, 01, 10","value":30},{"date":"2017, 01, 11","value":21},{"date":"2017, 01, 12","value":17},{"date":"2017, 01, 13","value":30},{"date":"2017, 01, 14","value":0},{"date":"2017, 01, 15","value":0},{"date":"2017, 01, 16","value":19},{"date":"2017, 01, 17","value":23},{"date":"2017, 01, 18","value":27},{"date":"2017, 01, 19","value":24},{"date":"2017, 01, 20","value":20},{"date":"2017, 01, 21","value":0},{"date":"2017, 01, 22","value":0},{"date":"2017, 01, 23","value":31},{"date":"2017, 01, 24","value":31},{"date":"2017, 01, 25","value":22},{"date":"2017, 01, 26","value":33},{"date":"2017, 01, 27","value":20},{"date":"2017, 01, 28","value":0},{"date":"2017, 01, 29","value":0},{"date":"2017, 01, 30","value":30},{"date":"2017, 01, 31","value":33},{"date":"2017, 02, 01","value":24},{"date":"2017, 02, 02","value":32},{"date":"2017, 02, 03","value":30},{"date":"2017, 02, 04","value":0},{"date":"2017, 02, 05","value":0},{"date":"2017, 02, 06","value":26},{"date":"2017, 02, 07","value":39},{"date":"2017, 02, 08","value":41},{"date":"2017, 02, 09","value":18},{"date":"2017, 02, 10","value":24},{"date":"2017, 02, 11","value":0},{"date":"2017, 02, 12","value":0},{"date":"2017, 02, 13","value":27},{"date":"2017, 02, 14","value":31},{"date":"2017, 02, 15","value":27},{"date":"2017, 02, 16","value":25},{"date":"2017, 02, 17","value":26},{"date":"2017, 02, 18","value":0},{"date":"2017, 02, 19","value":0},{"date":"2017, 02, 20","value":30},{"date":"2017, 02, 21","value":30},{"date":"2017, 02, 22","value":24},{"date":"2017, 02, 23","value":21},{"date":"2017, 02, 24","value":19},{"date":"2017, 02, 25","value":0},{"date":"2017, 02, 26","value":0},{"date":"2017, 02, 27","value":41},{"date":"2017, 02, 28","value":26},{"date":"2017, 03, 01","value":28},{"date":"2017, 03, 02","value":36},{"date":"2017, 03, 03","value":24},{"date":"2017, 03, 04","value":0},{"date":"2017, 03, 05","value":0},{"date":"2017, 03, 06","value":43},{"date":"2017, 03, 07","value":32},{"date":"2017, 03, 08","value":29},{"date":"2017, 03, 09","value":34},{"date":"2017, 03, 10","value":18},{"date":"2017, 03, 11","value":0},{"date":"2017, 03, 12","value":0},{"date":"2017, 03, 13","value":25},{"date":"2017, 03, 14","value":36},{"date":"2017, 03, 15","value":23},{"date":"2017, 03, 16","value":32},{"date":"2017, 03, 17","value":22},{"date":"2017, 03, 18","value":0},{"date":"2017, 03, 19","value":0},{"date":"2017, 03, 20","value":39},{"date":"2017, 03, 21","value":29},{"date":"2017, 03, 22","value":34},{"date":"2017, 03, 23","value":25},{"date":"2017, 03, 24","value":22},{"date":"2017, 03, 25","value":0},{"date":"2017, 03, 26","value":0},{"date":"2017, 03, 27","value":33},{"date":"2017, 03, 28","value":27},{"date":"2017, 03, 29","value":17},{"date":"2017, 03, 30","value":26},{"date":"2017, 03, 31","value":18},{"date":"2017, 04, 01","value":0},{"date":"2017, 04, 02","value":0},{"date":"2017, 04, 03","value":36},{"date":"2017, 04, 04","value":29},{"date":"2017, 04, 05","value":21},{"date":"2017, 04, 06","value":39},{"date":"2017, 04, 07","value":29},{"date":"2017, 04, 08","value":0},{"date":"2017, 04, 09","value":0},{"date":"2017, 04, 10","value":42},{"date":"2017, 04, 11","value":41},{"date":"2017, 04, 12","value":28},{"date":"2017, 04, 13","value":18},{"date":"2017, 04, 14","value":0},{"date":"2017, 04, 15","value":0},{"date":"2017, 04, 16","value":0},{"date":"2017, 04, 17","value":0},{"date":"2017, 04, 18","value":57},{"date":"2017, 04, 19","value":28},{"date":"2017, 04, 20","value":21},{"date":"2017, 04, 21","value":17},{"date":"2017, 04, 22","value":0},{"date":"2017, 04, 23","value":0},{"date":"2017, 04, 24","value":30},{"date":"2017, 04, 25","value":26},{"date":"2017, 04, 26","value":21},{"date":"2017, 04, 27","value":29},{"date":"2017, 04, 28","value":20},{"date":"2017, 04, 29","value":0},{"date":"2017, 04, 30","value":0},{"date":"2017, 05, 01","value":0},{"date":"2017, 05, 02","value":33},{"date":"2017, 05, 03","value":29},{"date":"2017, 05, 04","value":36},{"date":"2017, 05, 05","value":29},{"date":"2017, 05, 06","value":0},{"date":"2017, 05, 07","value":0},{"date":"2017, 05, 08","value":27},{"date":"2017, 05, 09","value":35},{"date":"2017, 05, 10","value":23},{"date":"2017, 05, 11","value":26},{"date":"2017, 05, 12","value":30},{"date":"2017, 05, 13","value":0},{"date":"2017, 05, 14","value":0},{"date":"2017, 05, 15","value":31},{"date":"2017, 05, 16","value":36},{"date":"2017, 05, 17","value":28},{"date":"2017, 05, 18","value":27},{"date":"2017, 05, 19","value":18},{"date":"2017, 05, 20","value":0},{"date":"2017, 05, 21","value":0},{"date":"2017, 05, 22","value":36},{"date":"2017, 05, 23","value":29},{"date":"2017, 05, 24","value":28},{"date":"2017, 05, 25","value":40},{"date":"2017, 05, 26","value":38},{"date":"2017, 05, 27","value":0},{"date":"2017, 05, 28","value":0},{"date":"2017, 05, 29","value":0},{"date":"2017, 05, 30","value":50},{"date":"2017, 05, 31","value":15},{"date":"2017, 06, 01","value":33},{"date":"2017, 06, 02","value":20},{"date":"2017, 06, 03","value":0},{"date":"2017, 06, 04","value":0},{"date":"2017, 06, 05","value":30},{"date":"2017, 06, 06","value":33},{"date":"2017, 06, 07","value":37},{"date":"2017, 06, 08","value":31},{"date":"2017, 06, 09","value":32},{"date":"2017, 06, 10","value":0},{"date":"2017, 06, 11","value":0},{"date":"2017, 06, 12","value":38},{"date":"2017, 06, 13","value":18},{"date":"2017, 06, 14","value":29},{"date":"2017, 06, 15","value":37},{"date":"2017, 06, 16","value":30},{"date":"2017, 06, 17","value":0},{"date":"2017, 06, 18","value":0},{"date":"2017, 06, 19","value":22},{"date":"2017, 06, 20","value":27},{"date":"2017, 06, 21","value":36},{"date":"2017, 06, 22","value":29},{"date":"2017, 06, 23","value":17},{"date":"2017, 06, 24","value":0},{"date":"2017, 06, 25","value":0},{"date":"2017, 06, 26","value":32},{"date":"2017, 06, 27","value":22},{"date":"2017, 06, 28","value":30},{"date":"2017, 06, 29","value":25},{"date":"2017, 06, 30","value":28},{"date":"2017, 07, 01","value":0},{"date":"2017, 07, 02","value":0},{"date":"2017, 07, 03","value":28},{"date":"2017, 07, 04","value":23},{"date":"2017, 07, 05","value":33},{"date":"2017, 07, 06","value":30},{"date":"2017, 07, 07","value":21},{"date":"2017, 07, 08","value":0},{"date":"2017, 07, 09","value":0},{"date":"2017, 07, 10","value":18},{"date":"2017, 07, 11","value":35},{"date":"2017, 07, 12","value":25},{"date":"2017, 07, 13","value":20},{"date":"2017, 07, 14","value":30},{"date":"2017, 07, 15","value":0},{"date":"2017, 07, 16","value":0},{"date":"2017, 07, 17","value":29},{"date":"2017, 07, 18","value":24},{"date":"2017, 07, 19","value":24},{"date":"2017, 07, 20","value":29},{"date":"2017, 07, 21","value":30},{"date":"2017, 07, 22","value":0},{"date":"2017, 07, 23","value":0},{"date":"2017, 07, 24","value":23},{"date":"2017, 07, 25","value":19},{"date":"2017, 07, 26","value":35},{"date":"2017, 07, 27","value":28},{"date":"2017, 07, 28","value":10},{"date":"2017, 07, 29","value":0},{"date":"2017, 07, 30","value":0},{"date":"2017, 07, 31","value":27},{"date":"2017, 08, 01","value":22},{"date":"2017, 08, 02","value":29},{"date":"2017, 08, 03","value":20},{"date":"2017, 08, 04","value":20},{"date":"2017, 08, 05","value":0},{"date":"2017, 08, 06","value":0},{"date":"2017, 08, 07","value":24},{"date":"2017, 08, 08","value":21},{"date":"2017, 08, 09","value":22},{"date":"2017, 08, 10","value":30},{"date":"2017, 08, 11","value":22},{"date":"2017, 08, 12","value":0},{"date":"2017, 08, 13","value":0},{"date":"2017, 08, 14","value":35},{"date":"2017, 08, 15","value":26},{"date":"2017, 08, 16","value":35},{"date":"2017, 08, 17","value":24},{"date":"2017, 08, 18","value":27},{"date":"2017, 08, 19","value":0},{"date":"2017, 08, 20","value":0},{"date":"2017, 08, 21","value":31},{"date":"2017, 08, 22","value":36},{"date":"2017, 08, 23","value":31},{"date":"2017, 08, 24","value":17},{"date":"2017, 08, 25","value":19},{"date":"2017, 08, 26","value":0},{"date":"2017, 08, 27","value":0},{"date":"2017, 08, 28","value":0},{"date":"2017, 08, 29","value":36},{"date":"2017, 08, 30","value":37},{"date":"2017, 08, 31","value":82},{"date":"2017, 09, 01","value":25},{"date":"2017, 09, 02","value":0},{"date":"2017, 09, 03","value":0},{"date":"2017, 09, 04","value":28},{"date":"2017, 09, 05","value":31},{"date":"2017, 09, 06","value":25},{"date":"2017, 09, 07","value":27},{"date":"2017, 09, 08","value":28},{"date":"2017, 09, 09","value":0},{"date":"2017, 09, 10","value":0},{"date":"2017, 09, 11","value":33},{"date":"2017, 09, 12","value":34},{"date":"2017, 09, 13","value":30},{"date":"2017, 09, 14","value":30},{"date":"2017, 09, 15","value":31},{"date":"2017, 09, 16","value":0},{"date":"2017, 09, 17","value":0},{"date":"2017, 09, 18","value":35},{"date":"2017, 09, 19","value":36},{"date":"2017, 09, 20","value":21},{"date":"2017, 09, 21","value":26},{"date":"2017, 09, 22","value":29},{"date":"2017, 09, 23","value":0},{"date":"2017, 09, 24","value":0},{"date":"2017, 09, 25","value":24},{"date":"2017, 09, 26","value":26},{"date":"2017, 09, 27","value":30},{"date":"2017, 09, 28","value":38},{"date":"2017, 09, 29","value":51},{"date":"2017, 09, 30","value":0},{"date":"2017, 10, 01","value":0},{"date":"2017, 10, 02","value":31},{"date":"2017, 10, 03","value":48},{"date":"2017, 10, 04","value":73},{"date":"2017, 10, 05","value":43},{"date":"2017, 10, 06","value":33},{"date":"2017, 10, 07","value":0},{"date":"2017, 10, 08","value":0},{"date":"2017, 10, 09","value":0},{"date":"2017, 10, 10","value":0},{"date":"2017, 10, 11","value":0},{"date":"2017, 10, 12","value":0}]}]
答案

这个问题实际上是一个PHP内存问题,因为生成日期JSON的SQL查询调用了太多数据来处理ajax响应。减少select语句中的SQL查询字段可以解决问题。

以上是关于Ajax Json对PHP7和IIS 7的限制的主要内容,如果未能解决你的问题,请参考以下文章

iis7配置php7

Windows10 下安装配置IIS + MySQL5.7.19 + nginx1.12.1 + php7.1.7

IIS部署wordpress4.7.4

如何配置 IIS 7.5 以使用“POST”方法接受对 .json 文件的请求

json_decode() (PHP 7) 中的新行和标签

如何使用ASP.NET MVC增加对AJAX JSON响应的2MB限制