Cant get sessions to work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Cant get sessions to work

Post by nigma »

When I try to start a session I get a message similar to this:

WARNING: session_start() [fuction.session-start]: open(/tmp\sess_25ff1bdc524011e280e625845ed204b9, O_RDWR) failed: No such file or directory (2) in C:/dir/to/script/that/uses/a/session.

Any one know what is going on and how to correct this problem?

Thanks for all help provided.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

set session.save_path in your php.ini to a valid path ( directory that exists and php can read/write)


http://www.php.net/manual/en/ref.session.php
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Thanks a bunch. I am checkin it out right now.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Okay. I tried doing that, it didn't work. But I dont think I did it right here is what I did:

Changed this line: ; session.save_path = "N;\path"
To this: ; session.save_path = "N;C:\path\to\session\save"

Is that right?

Also you have any suggestions on paths that would be bad for secuirity?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

N;?
just the path, e.g. mine is session.save_path = E:/webserver/sessions
Also you have any suggestions on paths that would be bad for secuirity?
hmmm...only thought that comes to my mind right now is: do not place it within your web-tree ;)
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

okay. So if my index.php file was in lets say C:\webserver\site\index.php

I wouldn't want to place it anywhere inside C:\webserver\site\.....

Is that about right?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Here is my session save path line:
session.save_path = C:\Program Files\Apache2\sessions\

I tried this I still get the same message. Then I tried creating the dir sessions, still no use. You know what I need to do?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What is listed as the session save path when you run a file containing:

Code: Select all

<?php
phpinfo();
?>
Mac
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

session.save_path reads: C:/Program Files/Apache2/sessions
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

I just thought of something; I got more than one error message when creating the session and maybe one of the other errors triggered the a problem with the session. If this is so then here are all the errors I recieved:

Warning: session_start() [function.session-start]: open(C:/Program Files/Apache2/sessions\sess_a283ff3c79b9eb7d9dd0bb5226386d11, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\mc0\validate.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\mc0\validate.php:6) in C:\Program Files\Apache Group\Apache2\mc0\validate.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\mc0\validate.php:6) in C:\Program Files\Apache Group\Apache2\mc0\validate.php on line 7
validated
Warning: Unknown(): open(C:/Program Files/Apache2/sessions\sess_a283ff3c79b9eb7d9dd0bb5226386d11, 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 (C:/Program Files/Apache2/sessions) in Unknown on line 0
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

has the account apache is running under permissions to read/write that directory (C:/Program Files/Apache2/sessions) ?
Test this by setting permissions to full access to anyone
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Right now apache is running under windows( I cant get linux to talk to the wireless USB card so no internet for linux). So I would think it does have permissions. Do I have to change something in one of the config files in order to give it full permissions?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

which version of windows?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

XP Pro
Brian
Forum Contributor
Posts: 116
Joined: Thu Apr 18, 2002 5:33 pm

Try using "C:\WINDOWS\Temp".

Post by Brian »

Try using "C:\WINDOWS\Temp".
Post Reply