[英]Result not showing if large result
这让我很头疼。 已经 4 小时了,我只是绕着它转了 :(。我的问题是当我从 mysql 获取大结果到 php 时,它不显示任何内容。总结果大约是 20000+ 数据。所以我所做的是限制结果为 1000,它确实按预期显示了结果。
是否需要设置或更改某些配置?
我的示例查询如下
不起作用(当结果超过 10000 时)
select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 10000
工作(只需将结果限制为 1000)
select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 1000
奇怪。 帮助任何人。
问候,
也许结果集占用太多内存。 这会导致致命错误,您是否激活了 error_reporting?
ini_set('display_errors', 1);
error_reporting(-1);
您可以通过将其添加到脚本中来设置更高的内存限制:
ini_set('memory_limit', '2048M'); // would be really high, but good enough to investigate on the problem
然后你可以使用memory_get_peak_usage()
来显示......好吧,内存消耗的峰值
您需要在 php.ini 中更改以下值
例如:
in php.ini
max_execution_time = 3000 // seconds
memory_limit = 512M
您可以在运行时使用 ini_set() 函数更改此值,如下所示。
ini_set("max_execution_time", "3000"); // seconds
ini_set("memory_limit","512M");
您可以根据需要更改秒数。
我使用 mssql 遇到了这个问题。 我的结果集被限制为 64512。尝试设置 MSSQL.TEXTSIZE 或 TEXTLIMIT。
如果php还是无视,也可以尝试配置FREETDS(/etc/freetds/freetds.conf @ubuntu)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.