PHP Sessions expire too soon

前端 未结 2 1864
名媛妹妹
名媛妹妹 2020-12-30 14:07

I\'m running a website with a nginx server with PHP Fastcgi on a VPS. I tried to configure the php.ini (in /etc/php5/cgi) to have PHP session last longer than 3 days (259200

相关标签:
2条回答
  • 2020-12-30 14:31

    To help you debug, you can check the current setting that the PHP cron job is "seeing" by executing:

    /usr/lib/php5/maxlifetime

    The maxlifetime script searches all your php.ini files for the session.gc_maxlifetime and uses the largest value. The value printed is in minutes.

    0 讨论(0)
  • 2020-12-30 14:47

    This sounds a bit like Ubuntu or Debian on the server. If I rememeber correctly there is a cronjob somewhere (installed either by the php5 or the php5-common package) which cleans out your session directory more often.

    I'd recommend you configure your sessions to be saved somewhere else (than the default). Adjust session.save_path and verify to cronjob doesn't empty it.

    The cronjob is somewhere like /etc/cron.d/php - to be certain, run dpkg -L php5 or dpkg -L php5-common. Assuming you are on Ubuntu (or Debian) this should show you the location of all installed files.

    0 讨论(0)
提交回复
热议问题