user1494517
user1494517

Reputation: 351

stop a session from timeouting on PHP

I'm making a project on PHP and it pretty much doesn't involve any human intervention, in other words, I'm making a special script that should run for a long time (a user visits my website and the script keeps running until the user exits...). The one problem that is concerning me is:

Won't the sessions expire when the script runs like this for a while? If So how could I bypass that, so it could run for a very a long time?

Oh, And one more question: Could my PHP script start by its own without any user intervention? If so, How could I configure it to do so?

Upvotes: 0

Views: 220

Answers (2)

Josejulio
Josejulio

Reputation: 1294

  1. You can use set_time_limit(0) to avoid the timeout.
  2. For the PHP script to start on its own, you could use a cron

Upvotes: 1

Willem Mulder
Willem Mulder

Reputation: 14014

You can run PHP from the command line. Those scripts do not have a timeout like user-called scripts. Otherwise, you can set the timeout with set_time_limit like

 set_time_limit(0); // 0 means no limit

See http://php.net/manual/en/function.set-time-limit.php

Upvotes: 1

Related Questions