Codeigniter - Blank screen when trying to retrieve 8500 records
I am trying to display a table which contains 8500 records, I am using the same controller/model functions as I have used throughout the site which all work fine.
On this page however, I just see a blank screen. Is this a known Issue wi开发者_高级运维th codeigniter? Is there a work around? I am totally stumped, my only option I guess is to split the table into sub tables?
I can show you my code if needed.
Thanks
Dan
When youget a blank screen it usually mean you've done something to receive a PHP error.
To see what that error is, check the php error log. I suspect that you've exceeded the maximuim allowed memory limit.
php_value memory_limit 256M
php_value display_errors 1
php_flag log_errors on
php_value error_log /some/path/on/the/box/you/have/acess/to.log
Below are the hard coded PHP ways to enable the settings, above this line are .htaccess directives you can set that will kick in for your whole app.
To make sure error reporting is turned on and you're displaying errors you can do..
ini_set('display_errors', 'On');
error_reporting(E_ALL);
To find out where your error log is make a test script to tell you.
die(ini_get('error_log'));
Make sure log_errors ini setting is enabled too in your php.ini file.
If it is indeed that you're exceeding the max allowed memory limit you can increase it by doing
ini_set(“memory_limit”,”256M”); // 256 megabytes
I recommend updating this in your php.ini file and restarting apache for the changes to kick in.
If your script is dealing with large amounts of data and it can take a while to run then you might also exceed the max_execution_time ini setting.
To see what it's currently set at, you can do
die(ini_get('max_execution_time'));
There is a nice PHP helper funciton to set this for you set_time_limit
set_time_limit(300); // Input in seconds, this is 5 minutes.
Hope this helps you get somewhere. Your best bet is looking at your error log though.
Good luck.
精彩评论