After installing on localhost (back up was done on functioning remote VPS) I have problems to login into Drupal as Admin. When I enter username/password I am presented with the "site is in maintenance" page. Just wondering... could this be caused by the fact that "localhost" in inconsistent with "*mydomain.com" still stored in the database? I tried to change it via phpMyAdmin, but I see only domain 1 and 2 in table domain, no domain 0. Or maybe the problem is somewhere else.

Comments

agentrickard’s picture

This likely has nothing to do with the values in the {domain} table.

Domain zero (0) is not stored in the database. It is derived from the variable settings on the main Domain settings page.

Domain 0 takes the variables of the main site straight from the variables table and the $conf array.

I do not know why this would occur, but your default site is set to offline mode. To fix this with PHPMyAdmin, go to the {variables} table, and set 'site_offline' to 0 (zero). Then delete the variables row from the {cache} table.

For reference, the default domain is created by this function.

function domain_default() {
  static $default;
  if (empty($default)) {
    $default['domain_id'] = 0;
    $default['sitename'] = variable_get('domain_sitename', variable_get('sitename', 'Drupal'));
    $default['subdomain'] = variable_get('domain_root', '');
    $default['scheme'] = variable_get('domain_scheme', 'http');
    // Set the valid flag.
    $default['valid'] = TRUE;    
    // Let submodules overwrite the defaults, if they wish.
    $extra = module_invoke_all('domainload', $default); 
    $default = array_merge($default, $extra);    
  }  
  return $default;
}    
skizzo@drupal.org’s picture

skizzo@drupal.org’s picture

Thanks. Fixing the variable did it. Still I have a problem with single session across all (localhost) domains. I have set $cookie_domain='localhost' in settings.php. Is that enough? When I switch from localhost to dom1.localhost to dom2.localhost it keeps prompting for user authentication.

agentrickard’s picture

That's a local Apache issue. I run tests on OS X (Apache 1.3). You have to configure named VirtualHosts in httpd.conf. I do not believe that you can add a third-level domain to 'localhost'.

agentrickard’s picture

Status: Active » Closed (fixed)
najibx’s picture

This is off topic isn't it? I was advised to put in a new issue for different topic.

Anyhow, i had a similar problem earlier when i name my local server
$cookie_domain="najibx-my";

Similarly, I guest this not a domain name the cookies is expecting. I then change to localhost to "najibx.my" and cookie :
$cookie_domain=".najibx.my";

it works. I guess you need something xx.xxx rather than just localhost or najibx-my

hope that help you.

agentrickard’s picture

It does help and it is on topic.

This is both an Apache configuration issue and part of the cookie standard. I was trying to configure a new testing server last night, and the NameServer must be in the format xx.xxx. For Domain Access to work, you must also be able to run different NameServers.

In testing, I edit my 'hosts' file and 'httpd.conf' to accept a dummy domain name. So, for example:

HOSTS
127.0.0.1 ken.test
127.0.0.1 www.ken.test
127.0.0.1 one.ken.test
127.0.0.1 two.ken.test
127.0.0.1 three.ken.test
127.0.0.1 testuser.ken.test
VHosts

<VirtualHost ken.test>
  ServerAdmin ken@test.com
  DocumentRoot "/Library/WebServer/htdocs"
  ServerName ken.test
  ErrorLog "/private/var/log/httpd/error_log"
</VirtualHost>

Then I set Drupal's $cookie_domain to '.ken.test'

However, I am not an Apache expert and there are probably better ways to do this.

skizzo’s picture

I ended up with a similar setup for local testing on Fedora:

$cookie_domain = 'localhost';

/etc/hosts:
::1 localhost
::1 one.localhost two.localhost three.localhost

httpd.conf:
configured 3 virtual servers
one.localhost two.localhost three.localhost

silverwing’s picture

Title: testseite1 » Moving from qualified domain to localhost