note 78151 added to ref.session
| From: | carl/a/suchideas/o/com at osu1 dot php dot net | Date: | Sun, 30 Sep 2007 16:45:16 +0000 |
| Subject: | note 78151 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130948@lists.php.net to get a copy of this message | ||
Another gotcha to add to this list is that using a relative session.save_path is a VERY BAD idea.
You can just about pull it off, if you're very careful, but note two related points:
1) The path is taken relative to the directory of the ORIGINALLY executed script, so unless all
pages are run from the same directory, you'll have to set the directory separately in each
individual subfolder
2) If you call certain functions, such as session_regenerate_id(), PHP will try to take the session
directory relative to the exectuable, or something like that, creating an error IN the executable.
This provides slightly cryptic error messages, like this:
Warning: Unknown: open(relative_path\ilti9oq3j9ks0jvih1fmiq4sv1.session, 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 (relative_path) in Unknown on line 0
... so don't even bother. Just use
<?php ini_set("session.save_path",dirname(__FILE__)."/relative_path"); ?>
(or equivalent) in a file which you know is always in the same place relative to the file.
{PHP version 5.1.6}
----
Server IP: 194.145.210.4
Probable Submitter: 84.43.70.129
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- https://master.php.net/note/edit/78151
Del: integrated -- https://master.php.net/note/delete/78151/integrated
Del: useless -- https://master.php.net/note/delete/78151/useless
Del: bad code -- https://master.php.net/note/delete/78151/bad+code
Del: spam -- https://master.php.net/note/delete/78151/spam
Del: non-english -- https://master.php.net/note/delete/78151/non-english
Del: in docs -- https://master.php.net/note/delete/78151/in+docs
Del: other reasons-- https://master.php.net/note/delete/78151
Reject -- https://master.php.net/note/reject/78151
Search -- https://master.php.net/manage/user-notes.php