PHP (or MySQL) crash when retrieving a big database record (~5MB)

给你一囗甜甜゛ 提交于 2020-01-03 18:35:15

问题


It doesnt display any errors, just a blank page. I tried die('test') before I call my function to retrieve a record and it does it, but when I place die('test') after my retrieve row function all I get is an empty page (on chrome it says this: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.)

.. I have tried (with 128M, -1, 64M, etc)

ini_set('memory_limit', -1);

With no luck. I am using mysqli to retrieve the record and a simple query like 'Select data from tblBackup' (only 1 record in the database)

Any help?

Thanks in advance

Update: I tailed the apache error log and I get this when trying to load the page,

[Thu Jun 30 13:47:37 2011] [notice] child pid 25405 exit signal Segmentation fault (11)

回答1:


Checkout php.ini variables for execution time. Sounds like PHP might be timing out.

max_execution_time =3000
max_input_time = 6000

Also, you may have this done at the .ini level, but you can add this to get the PHP error. Put these at the top of your file:

error_reporting(E_ALL);
ini_set('display_errors', '1');



回答2:


What's the client and server settings for max_allowed_packet? If it's smaller than than the ~5MB blob you're trying to send across, then the connection will be killed.




回答3:


Well, been there man. But at the end of the day: Is that a good way, to handle the query? If you have many results, then LIMIT them down.. maybe with pagination?

Because yes, you can set the limits higher, but in a longer run.. is it really the most effective way?




回答4:


While compiling php, my --with-pdo-mysql=[DIR] flag seemed to cause the issue. I removed the [DIR] and left it blank. The problem is gone.



来源:https://stackoverflow.com/questions/6538484/php-or-mysql-crash-when-retrieving-a-big-database-record-5mb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!