Welcome Guest, Not a member yet? Register   Sign In
Database Sessions removing data,
#1

[eluser]Unknown[/eluser]
I'm using CodeIgniter 2.0.2 and when my session gets over 4kb the session is killed. I've read that using cookies for your session will result in this problem, but my application uses a database for the session.

Any idea why this would be happening? If you need more information I can supply it.

CodeIgniter 2.0.2
Database: Microsoft SQL Server 9

The error in the log is:
Code:
ERROR - 2011-05-25 09:49:35 --&gt; Severity: Notice  --&gt; unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 4096 of 4096 bytes
#2

[eluser]tonanbarbarian[/eluser]
the issue is that the default database table design used for storing the sessions has a TEXT field for user_data which has a limit 64K on MySQL
however if you have replicated that table in Microsoft SQL Server then you need to make sure that the user_data field is large enough that it can hold that data you are working with serialised.
Not being familiar with the Microsoft SQL Server data types I cannot advise the best type to use, but obviously it should be something that can handle similar amounts of data to the MySQL TEXT field, i.e. 64K, or higher if you feel you will need it.
#3

[eluser]InsiteFX[/eluser]
Also this will happen is you have the user_agent check enabled! You need to update the seesion table because they made a change to it!

user_agent should be varchar(120) not varchar(50)

InsiteFX
#4

[eluser]Unknown[/eluser]
It turns out the default text limit that php returns for MSSQL is 4096, changing it in the php.ini file or setting it in my config fixed the problem.

[Problem]
Code:
; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textlimit = 4096

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textsize = 4096

[Fix]
Code:
ini_set('mssql.textlimit', '65536');
ini_set('mssql.textsize', '65536');




Theme © iAndrew 2016 - Forum software by © MyBB