using the SESSION superglobal

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
joki
Forum Newbie
Posts: 3
Joined: Tue Mar 09, 2004 6:42 am

using the SESSION superglobal

Post by joki »

Hi

I am having a problem with the SESSION superglobal. When I use the session_start(); command within a php page I have an error of "Warning: session_start(): open(/tmp\sess_91fe588e6cb297919441b949431254f1, O_RDWR) failed: No such file or directory (2) in c:\web\listing10.2.php on line 2 So I changed the setting of session.auto_start = 1 in the php.ini, which fixes this problem but I then have a problem which is Warning: Unknown(): open(/tmp\sess_562f3ba648ebc190d50011c8b45e9209, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Can anyone help??
Thanks
Joki
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Look for the session.save_path definition in your php.ini file and set that to the full path of a directory you want to use for storing session data.

The session.save_path will most likely be set to /tmp at the moment so setting it to something like....

session.save_path = "C:\windows\temp"

Should fix your problem.
joki
Forum Newbie
Posts: 3
Joined: Tue Mar 09, 2004 6:42 am

Post by joki »

thanks redmonkey, works fine now :)
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Your welcome.
mtnwinds
Forum Newbie
Posts: 5
Joined: Thu Mar 18, 2004 10:50 am

Sessions directory does not exist

Post by mtnwinds »

I've been unable to resolve this message. I've tried changing "session.save_path" as suggested above but the error persists: Warning: session_start(): open(/tmp\sess_abe4e322cfe4629a5791866fdb65b662, O_RDWR) failed: No such file or directory (2) in e:\easyphp1-7\www\catalog\includes\functions\sessions.php on line 67

Would really appreciate any help :x
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Your session.save_path is still wrong. Make sure you're editing c:\windows\php.ini , change session.save_path to something like c:\temp (or some other temp directory that exists) then restart apache.
Also check a phpinfo() page ( just <?php phpinfo() ?> in a file ), that will show you the value of session.save_path
mtnwinds
Forum Newbie
Posts: 5
Joined: Thu Mar 18, 2004 10:50 am

Post by mtnwinds »

php.ini is no longer stored in c:\windows. Mine is in ..\apache\. phpinfo() returns the correct path, which exists on my hard drive.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Not sure what's going on then. If you put the following line at the top of the script that produces the error, what does it output?

echo ini_get('session.save_path');
mtnwinds
Forum Newbie
Posts: 5
Joined: Thu Mar 18, 2004 10:50 am

Post by mtnwinds »

Also, if I set sessions.auto_start to 1, the error msg. changes somewhat. It drops the ref. to the specific call that fails and simply says the path doesn't exist. However, when I check the /tmp dir I find a session file exist there.
mtnwinds
Forum Newbie
Posts: 5
Joined: Thu Mar 18, 2004 10:50 am

Post by mtnwinds »

This is what it returns...which is the correct path: E:\EasyPHP1-7\tmp
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Well, if it's not using the save_path that's in your php.ini then i can only think it's coming from a .htaccess or in a vhost section of your httpd.conf ... if it's neither of those 2, then i'm all out of ideas :o
mtnwinds
Forum Newbie
Posts: 5
Joined: Thu Mar 18, 2004 10:50 am

Post by mtnwinds »

I found it Mark. I'm running the oscommerce catalog file (http://www.oscommerce.com) When you asked me to insert 'echo ini_get('session.save_path') I found the 'index.html' file & stuck it in there. When that didn't work I got to thinking that there must be another file and there was...configure.php located in ..\catalog\includes. At the very bottom there is: define('STORE_SESSIONS', ' '. The recommendation is to set it to MySQL but I set it to 'e:/easyphp1-7/tmp'); and that did the trick. Appreciate your help very much & hope this post will help someone else out.
Post Reply