Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 11:49 AM
jim
Guest
 
Posts: n/a
Default set session timeout in code

Can I set the session timeout in my code? I don't have access to php.ini
because the site is on a shared server.


  #2  
Old July 17th, 2005, 11:49 AM
Andy Hassall
Guest
 
Posts: n/a
Default Re: set session timeout in code

On Wed, 19 Jan 2005 12:09:18 -0600, "jim" <info@info.com> wrote:
[color=blue]
>Can I set the session timeout in my code? I don't have access to php.ini
>because the site is on a shared server.[/color]

You don't need access to php.ini: http://uk.php.net/session notes that all the
session configuration variables are PHP_INI_ALL changeable, and links to
ini_set(), the function you can use to change them.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
  #3  
Old July 17th, 2005, 11:49 AM
bob garbados
Guest
 
Posts: n/a
Default Re: set session timeout in code

Thanks for your reply. I'm brand new to php and I'm trying to troubleshoot
a session timeout problem, so my questions are probably simple... If I want
the session to last as long as the browser is open, do I put the following
line of code in ALL of my web pages?

ini_set("session.cookie_lifetime", "0");

Do I have to put this line before or after session_start();?




"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:j4etu0ppaudl8qds46f41jct6dunttslpl@4ax.com...[color=blue]
> On Wed, 19 Jan 2005 12:09:18 -0600, "jim" <info@info.com> wrote:
>[color=green]
> >Can I set the session timeout in my code? I don't have access to php.ini
> >because the site is on a shared server.[/color]
>
> You don't need access to php.ini: http://uk.php.net/session notes that[/color]
all the[color=blue]
> session configuration variables are PHP_INI_ALL changeable, and links to
> ini_set(), the function you can use to change them.
>
> --
> Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool[/color]


  #4  
Old July 17th, 2005, 11:49 AM
Andy Hassall
Guest
 
Posts: n/a
Default Re: set session timeout in code

On Wed, 19 Jan 2005 13:54:35 -0600, "bob garbados" <bobgarbados@yahoo.com>
wrote:
[color=blue]
>Thanks for your reply. I'm brand new to php and I'm trying to troubleshoot
>a session timeout problem, so my questions are probably simple... If I want
>the session to last as long as the browser is open, do I put the following
>line of code in ALL of my web pages?
>
>ini_set("session.cookie_lifetime", "0");[/color]

Yes, although that's the default anyway - have your host changed it?
[color=blue]
>Do I have to put this line before or after session_start();?[/color]

Before.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
  #5  
Old July 17th, 2005, 11:49 AM
bob garbados
Guest
 
Posts: n/a
Default Re: set session timeout in code

My host has it set to 1200 seconds. Thanks for the help.


"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:71ftu09ru56eitlafdrstvst79k7nuctka@4ax.com...[color=blue]
> On Wed, 19 Jan 2005 13:54:35 -0600, "bob garbados" <bobgarbados@yahoo.com>
> wrote:
>[color=green]
> >Thanks for your reply. I'm brand new to php and I'm trying to[/color][/color]
troubleshoot[color=blue][color=green]
> >a session timeout problem, so my questions are probably simple... If I[/color][/color]
want[color=blue][color=green]
> >the session to last as long as the browser is open, do I put the[/color][/color]
following[color=blue][color=green]
> >line of code in ALL of my web pages?
> >
> >ini_set("session.cookie_lifetime", "0");[/color]
>
> Yes, although that's the default anyway - have your host changed it?
>[color=green]
> >Do I have to put this line before or after session_start();?[/color]
>
> Before.
>
> --
> Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles