Forum Moderators: coopster
session.use_cookies = 1
session.use_only_cookies = 0
session.use_trans_sid = 1
session.name = PHPSESSID
I call session_start() on each page.
I turn off the cookies in my browser and browse my site. The session doesn't work and no "PHPSESSID" appears in any URL!
Any idea?
Here's a snippet from the PHP manual. See the last line.
// page1.phpsession_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
PHP is capable of transforming links transparently. Unless you are using PHP 4.2 or later, you need to enable it manually when building PHP. Under Unix, pass --enable-trans-sid to configure. If this build option and the run-time option session.use_trans_sid are enabled, relative URIs will be changed to contain the session id automatically.
Yes, I happen to have --enable-trans-sid shown in phpinfo() under the configure command. But I'm also on PHP 4.3.
I'm having exactly the same problem and haven't found a solution. I gave up on it though, since I found many articles saying that passing SID throuhg URLs is not secure. So too bad for the users that don't use cookies. :P
Users will have to have their cookies enabled exept for some pages. But I'm providing a site map that can be browsed without cookies and that give access to all the content... I hope the search engines will be happy with it!
I'm still curious about the problem though. Is it a problem on Windows only?
At least I'm not the only one for whom it doesn't work!