Session Problems :(

This is a discussion on "Session Problems :(" within the PHP Forum section. This forum, and the thread "Session Problems :( are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 1st, 2005, 11:23
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
Session Problems :(

I'm just getting to grips with PHP, and trying to figure out a way of making sure people are logged in, like using the session variables in ASP. But when I put session_start(); at the top of my home page, i get loads of warnings:

Code: Select all
Warning: session_start(): open(/tmp\sess_e2478c752cf8239fb5ba8e8b7dda89e6, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 3

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\test.php:3) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 3

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\test.php:3) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 3

Warning: Unknown(): open(/tmp\sess_e2478c752cf8239fb5ba8e8b7dda89e6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
can anyone help?

  #2 (permalink)  
Old Jun 1st, 2005, 11:33
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
My guess is that this is very much related to this:-
http://www.webforumz.com/viewtopic.php?p=22236#22236

In other words.... they are warnings... not errors and you can turn them off somehow.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Jun 1st, 2005, 13:39
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
thanks rob - have turned them off, but $_SESSION variables are not constant from page to page - they lose their value when you click a link - do you know why?
  #4 (permalink)  
Old Jun 1st, 2005, 14:13
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Are you sure you're using PHP 4.1 or later? $_SESSION cannot be used prior to PHP 4.1.

Also, do you have register_globals turned on in your php.ini? If so then you'll need to register your variables using session_register('myvar');
  #5 (permalink)  
Old Jun 1st, 2005, 16:09
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
im using php 4.3.3, and i have tried it both registering variables with session_register and both with register_globals turned on in php.ini
  #6 (permalink)  
Old Jun 1st, 2005, 16:12
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
i found this in php.ini:

Quote:
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
; As of PHP 4.0.1, you can define the path as:
; session.save_path = "N;/path"
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
session.save_path = /tmp
is that anything to do with it? it says Windows users have to change this - to what?
  #7 (permalink)  
Old Jun 1st, 2005, 18:10
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
To anything you choose... Eg: C:\temp
Just create that folder and change the path.
  #8 (permalink)  
Old Jun 1st, 2005, 18:45
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
sessions are still not holding values...
  #9 (permalink)  
Old Jun 1st, 2005, 18:51
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
ok, i've solved it guys. For some reason, PHP did not like me putting session_start(); at the top of my pages, so i decided to set the auto start session thingy in php.ini to 1 rather than 0, and that did the trick. ty for u help tho
Closed Thread

Tags
session, problems

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Problems with Session Variables... JustinStudios PHP Forum 5 Jan 17th, 2008 05:05
are session safe? alexgeek PHP Forum 8 Aug 30th, 2007 10:45
Session variables ideleon PHP Forum 2 Feb 7th, 2006 08:04
session problem fender79 Classic ASP 8 May 18th, 2005 02:26
session php iamzoli PHP Forum 2 Apr 7th, 2004 05:49


All times are GMT. The time now is 06:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43