views:

51

answers:

1

Hi,

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 with 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

+5  A: 

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.

Paul Dragoonis
yup, simple great
Mithun P
Thanks for the input Paul.The application is sat on a shared server so I do not have direct access to the php.iniWhere is the best place to but these directives? in my controller or the view file?e.g.ini_set(“memory_limit”,”256M”); // 256 megabytes
Dan C
Dan, put them in the .htaccess file then. htaccess overrides php.ini for all files in the same directory and all sub dirs. I've updated the post with more .htaccess directives you can specify
Paul Dragoonis
Thanks again Paul, were getting there!One time it will load fine, then for the next 5 times I get the blank screen - Strange!!Does this suggest anything to you?
Dan C
Every time you get a blank screen, check your error log as i advised above
Paul Dragoonis
hmmm, there is no error messages in there just debug messages detailing which libraries etc were loading and a message to say that the template and view file were loaded.
Dan C
Alright, well i've helped you with the inital question but the rest is actual debugging of your app something that can't be done on Stack overflow. Accept my answer if you feel it was helpful enough.
Paul Dragoonis