473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

set session timeout in code

jim
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.
Jul 17 '05 #1
4 2165
On Wed, 19 Jan 2005 12:09:18 -0600, "jim" <in**@info.com> wrote:
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.


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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
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" <an**@andyh.co.uk> wrote in message
news:j4********************************@4ax.com...
On Wed, 19 Jan 2005 12:09:18 -0600, "jim" <in**@info.com> wrote:
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.
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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

Jul 17 '05 #3
On Wed, 19 Jan 2005 13:54:35 -0600, "bob garbados" <bo*********@yahoo.com>
wrote:
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");
Yes, although that's the default anyway - have your host changed it?
Do I have to put this line before or after session_start();?


Before.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4
My host has it set to 1200 seconds. Thanks for the help.
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:71********************************@4ax.com...
On Wed, 19 Jan 2005 13:54:35 -0600, "bob garbados" <bo*********@yahoo.com>
wrote:
Thanks for your reply. I'm brand new to php and I'm trying to troubleshoota session timeout problem, so my questions are probably simple... If I wantthe session to last as long as the browser is open, do I put the followingline of code in ALL of my web pages?

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


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


Before.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Geigho | last post by:
Setting session timeout in web.config file does not seem to have any effect. Any explanation or suggestion will be appreciated.
4
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site...
8
by: Joe Abou Jaoude | last post by:
hi, I have a web app with forms authentication and a timeout session of 20 mins for security reasons. I recently added a feature that allows users (if they want to) to automatically log in...
11
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
8
by: bdeviled | last post by:
I am deploying to a web environment that uses load balancing and to insure that sessions persist across servers, the environment uses SQL to manage sessions. The machine.config file determines how...
2
by: Tomas Martinez | last post by:
Hi, Well, my problem is so simple as it says in the subjet but very frustrating also. I have a project and it is losing the session variables with each postback, so I downloaded from the web a...
4
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
25
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I tried: <sessionState timeout="1"> </sessionState> bounced IIS, and after 1 minute still had a session. ??? -- thanks - dave
3
by: trullock | last post by:
Hi, I want to test some session timeout code ive written but im getting a few problems. I want to reduce the session timeout to 1min so i dont have to wait around for 20 min to see if my code...
6
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.