dr5648 2014-01-28 12:40
浏览 44
已采纳

PHP SESSION重置过多的数据

I've created a test file to find out how big my session can be.

It's something like this:

print_r($_SESSION);
$test = array();

for ($i=0;$i<3320;$i++) {
    $test[$i] = "test:)";
}

$size = mb_strlen(serialize($test), '8bit');

echo "Size: $size";

$_SESSION['test'] = $test;

When I do this, the $_SESSION['test'] gets reset (its value is nothing). When I'm doing this in a lesser for (3319 times) or for a shorter string, then it's working fine. Size value is in this case 65279 bytes. I figure I should be able to change some setting in php.ini to be able to store more data, but which one would that be?

Just for your information - I don't care about performance, there shouldn't be really more than one person at the time using the script and it's for some synchronization with another server so the user will need to wait anyway. I'm just looking for an information how can I store more data in the $_SESSION table.

My PHP version is 5.2.17 and I'm using osCommerce (really old one).

  • 写回答

2条回答 默认 最新

  • doulidai6316 2014-01-28 17:47
    关注

    Sorry for misguiding guys. It seems the reason for that was that I was storing the session in database (using osCommerce). Database field which holds the value of session was set to be of type Text which is 64KB. I've changed it to Mediumtext (16MB). If someone needs even more data in their sessions they might want to use Longtext (4GB).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致