Jump to content

PHP Sessions Aren't Working - No such file or directory (2)


wizzbangca

Recommended Posts

I get the following errors:

 

Warning: session_start() [function.session-start]: open(c:\tmp\sess_le36ojrhr693ck8f98bh5m8ma1, O_RDWR) failed: No such file or directory (2) in C:\Inetpub\wwwroot\filetest.php on line 2

 

Warning: Unknown: open(c:\tmp\sess_le36ojrhr693ck8f98bh5m8ma1, 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:\tmp) in Unknown on line 0

 

The code for the entire php file:

session_start();

include("functions/fileops.php");

$dir = "";

If (isset($_SESSION['dir'])) 
{ 
echo "<p>Prev Session: {$_SESSION['dir']}</p>";
$dir = $_SESSION['dir']; 	
echo "<p>Session Dir: {$dir}</p>";
}
else { 

$dir = "d:/shared/"; 
echo "<p>new folder: {$dir}</p>";

}
if (isset($_GET['dir'])) 
{ 
echo "<p>Get: {$_GET['dir']}</p>";
$dir .= $_GET['dir'] . "/"; 
echo "<p>Get Dir: {$dir}</p>";
}
echo "<p>Current Dir: {$dir}</p>";
$_SESSION['dir'] = $dir;
echo "<p>New Session: {$_SESSION['dir']}</p>";
ReadDirectory($dir);

 

Contents of php.ini:

[session]
; Handler used to store/retrieve data.
session.save_handler = files

; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
session.save_path = "c:\tmp"

 

I checked for the existence of c:\temp, does exist right where the folder should be.  Checked permissions on the folder.  Everyone has full access to the folder.  Tried changing the session.save_path to c:\windows\temp, c:\php\temp, c:\ with no luck.  Checked the permissions to all the different folders I changed session.save_path to, all have everyone will full access.

 

I am running php 5.2.4 on IIS on windows 2003.

 

Any ideas?  I have been searching everywhere and nothing seems to work.

Link to comment
Share on other sites

I did have c:\temp, that's what the back up from sunday shows.  With the changes, I types temp wrong.  The errors don't come up anymore, thanks.  I'm not surprised I made that kind of mistake with all the problems I have faced getting this project moving.  PHP wouldn't install, then once PHP did install, PHP pages weren't being compiled.  Once compiling was fixed, MySQL modules weren't being loaded.  Took 2 days to fix that, and still don't know how that was fixed.  Then session errors showed up.  That's fixed, thanks again. 

 

Now, session variables aren't being kept from page to page.  $_SESSION['dir'] is being wiped every time the page loads.  Links to the next level folders refer to the same page, but add &dir=directory.  $_GET['dir'] works fine.  However, echo "<p>Prev Session: {$_SESSION['dir']}</p>"; shows an empty variable.  The first loading of the page shows the session file on the server has the correct information.  Once a next level folder is clicked, $_SESSION['dir'] shows empty in the If statement, effectively setting an empty $dir, which then gets set to just the next level folder rather than the entire path that I need.  The same session file on the server shows just the next level folder that is clicked. 

 

How do I get the session variable dir to keep after a link is clicked?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.