Yii session expire too fast

In my app I set session variable like this:


    Yii::app()->session['id'] = $user->id;

But after some hours its expire.

I tried to set session.gc_maxlifetime to 31536000 but its doesnt help.

How I may increase session time?

Hello two_pizza I’m sure you think that’s a good idea but it’s not. There are fundamental security issues you are exposing and putting on risk. That’s the main reason session expire. If you’ve a strong reason to keep session in such a long lifetime period we can help you, but re-think so once again please.

You can set session timeout in main.php configuration file:


	'components'=>[

		'session'=>[

			'timeout'=>36000,	// 36 000 seconds

		],

	],