0

I am working session topic using cakephp application in Nginx server:

When I am uploading large files which takes more than an hour, Session is timed out and once the upload percentage reaches to 100% page is refreshing and showing the login page. I am new to this session concept.

Tried adding session start with cookie_lifetime in application:

session_start([
  'cookie_lifetime' => 86400,
]);

Modified php.ini:

upload_max_filesize = 3072M
post_max_size = 3072M
session.gc_maxlifetime = 6144 

How to make current session alive and access stored values in session? How to increase session timeout?

utengr
  • 3,225
  • 3
  • 29
  • 68
Dollyh
  • 107
  • 7

1 Answers1

0

Set the PHP time limit to 60 minutes

set_time_limit(3600);
ini_set('set_time_limit', '3600');

Set PHP max execution time

ini_set('max_execution_time',3600);

Set PHP max input time

ini_set('max_input_time','200')

Set the session lifetime

ini_set('session.gc_maxlifetime',84000);
ini_set('session.cookie_lifetime',84000);

Set the memory limit

ini_set('memory_limit','512M');

Setting maximum filesize

ini_set('upload_max_filesize', '3072M');
ini_set('post_max_size', '3072M');
Mr Pro Pop
  • 666
  • 5
  • 19
  • Thankyou. I added all parameters but no result. Still the issue remains same. – Dollyh Sep 28 '17 at 10:03
  • @Dollyh I updated my answer, copy the code and try again. – Mr Pro Pop Sep 28 '17 at 10:11
  • 1
    You should be doing something wrong. I personally have this and it works fine for me. On my website, movies and big clips are being uploaded. Try editing the size and time values to your own. ( Make them bigger ) – Mr Pro Pop Sep 28 '17 at 12:04
  • Okay, I will try out again. In my case uploads will go for more than 2 hours depends on the client bandwidth. According to this I increased the values. For quick check I made session maxlifetime to 1 min and checked still it shows maxlife time is 1 hour. But when I checked through phpinfo(); it showed updated values. – Dollyh Sep 28 '17 at 12:42
  • Are you using ini_set or updating values from the .ini file? – Mr Pro Pop Sep 28 '17 at 13:08
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/155513/discussion-between-dollyh-and-mr-pro-pop). – Dollyh Sep 28 '17 at 13:11