Results 1 to 3 of 3

Thread: Storing Data To Config File

  1. #1
    Join Date
    Jul 2006

    Storing Data To Config File


    I am having some problems trying to store data into a config file in Codeigniter

    The Problem
    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?

    Other Details
    - 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...

  2. #2
    Join Date
    Jul 2010
    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 use (, ; : -) as I please- instead of learning the English language specification: I decided to learn Scheme and Java;

  3. #3
    Join Date
    Aug 2004
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center