Storing Data To Config File
I am having some problems trying to store data into a config file in Codeigniter
The session data grows too big and seems to exceed the 4kb which is the cookie max size. As a result for example flashdata stops working.
Why It Happens
It seems that config variables are added 4 times into the session inside of following objects:
- CI_Hooks Object (should be turned off)
- CI_Utf8 Object
- MY_Router Object (used for replacing '_' with '-' in URL)
- CI_URI Object
Interestingly the hooks object is present even if the functionality is turned off in the config file: $config['enable_hooks'] = FALSE;
01 - how do you store config data without it being multiplied in the session?
02 - also, why does the hooks object seem to be enabled when it has been disabled in the config?
- CI_VERSION 2.1.3
- Session library is autoloaded
- Sessions are stored into db
- Session cookie is encrypted
- Config files are loaded in the pages where they are used, mainly inside constructors
- The config data is not huge and would fit very well to 4kb if it wasn't multiplied
Session data ( print_r($this->session) ) :
[hooks] => CI_Hooks Object ( [enabled] => [hooks] => Array ( ) [in_progress] => ) [config] => CI_Config Object ( [config] => Array...
Thanks in advance for your help, it would be much appreciated...
you could serialize the data and write it to a seperate file instead of trying to write it in a configuration file format. It seems like the sensible tool to use in this situation.
I would be a bit surprised if it were a cookie issue, as all the session cookie should include is a session identifier (which is then used to access the session data from wherever you're storing it on the server side. Now, if you're storing the session data in the DB, you may need to change the definition of the column where the data is being stored, so that it can hold more data.
If the config data is already in a file, it does not seem to me that the file data itself should need to be stored in the session data, but instead just the file path/name (or whatever minimal information is needed to know which file to include or read into a variable, or whatever you need to do with it.
Or I'm completely misunderstanding what's going on.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)