[support] No Cookies Being Sent with 5.1

Luke drupal at lists.tacticus.com
Sun Feb 24 06:54:33 UTC 2008


I decided to go ahead and test the PHP session handling capability outside 
of Drupal, using lynx as the web browser.

I started with this:

<?php
   session_start();
   if (!isset($_SESSION['count'])) {
       $_SESSION['count'] = 0;
   } else {
       $_SESSION['count'] += 32;
   }

echo "<html><body>{$_SESSION['count']}</body></html>";
   ?>

As I expected, not only did lynx receive a cookie, but the page 
incremented by 32 every time I reloaded it, as one would expect from this 
code.

Okay, so not a basic sessions problem between PHP and Lynx.

So then I moved on...  I pulled the INI changes from the settings.php 
file, and added them to the mix:

ini_set('arg_separator.output',     '&amp;');
ini_set('magic_quotes_runtime',     0);
ini_set('magic_quotes_sybase',      0);
ini_set('session.cache_expire',     200000);
ini_set('session.cache_limiter',    'none');
ini_set('session.cookie_lifetime',  2000000);
ini_set('session.gc_maxlifetime',   200000);
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid',    0);
ini_set('url_rewriter.tags',        '');

Installing those options made no difference--the cookie was still sent to 
lynx, and the number incremented.

Lastly, I added this, also from settings.php:

if (isset($_SERVER['HTTP_HOST'])) {
  $domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
  // Per RFC 2109, cookie domains must contain at least one dot other than the
  // first. For hosts such as 'localhost', we don't set a cookie domain.
  if (count(explode('.', $domain)) > 2) {
    ini_set('session.cookie_domain', $domain);
  }
}

and boom: no cookie, no incrementing number.

So I commented out the identical section in settings.php, as the comments 
therein suggest, with no joy.

I then tried manually setting the cookie domain, but still no joy.

Back now to square one.

The only thing different between what I ran and what Drupal is running, 
seems to be the following directive:

ini_set('session.save_handler',     'user');

I would not expect that to be the problem, but my knowledge is limited.

Luke


More information about the support mailing list