Re: Sessions
| From: | Lowell Allen | Date: | Sun, 12 Oct 2003 01:18:40 +0000 |
| Subject: | Re: Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165876@lists.php.net to get a copy of this message | ||
> I checked the session settings with phpinfo(); I get the following values:
> session_save_path = /tmp
> session.use_cookies = On
> session.use_trans_sid = 1
>
> I've created a folder on the same level as all the pages called
> "ccb_sessions" and have CHMOD it to 777.
> I have added the following snippet above session_start: <?php
> session_save_path("/ccb_sessions");?>
> When navigating to my test page I get the following error:
>
> Warning: open(/ccb_sessions/sess_bbbfa69631155d4097e0b0012c857c4a, O_RDWR)
> failed: No such file or directory (2) in
> /home/.paco/campuscb/campuscorkboard.com/MemberAccountDetails.php on line 2
>
> Checking with my FTP client that file is there and has CHMOD values of 777.
> I've done a Google search for "No such file or directory", found a bunch of
> stuff for Python, nothing for PHP.
[snip]
> Other ideas?
I think you need to provide a full directory path. I looked at my code and
here's exactly what I do. First, I include some functions with a
require_once() statement. One of the functions is prepath():
function prepath($url) {
$prepath = "";
if (substr_count($url, "/")) {
for ($i = 1; $i < substr_count($url, "/"); $i++) {
$prepath .= "../";
}
}
return $prepath;
}
That lets me use the same statement in different directories. Then the page
actually starts like this:
require_once($req_fns);
session_save_path(prepath($PHP_SELF) . "../ccb_sessions");
session_start();
Note that when I said my session data directory is on the same level as my
publicly viewable files (public_html), I mean that the session directory is
not contained within public_html, but is outside it at the same directory
level on the server.
HTH
--
Lowell Allen