Was trying once more to get these 2 modules to both work and was still getting this error:

Domain access failed to load during phase: 2. Please check your settings.php file and site configuration.

then i looked at the settings.inc file came across domain_settings_setup_ok():

function domain_settings_setup_ok() {
  $state = &drupal_static(__FUNCTION__, NULL);
  if ($state === NULL) {
    $state = !function_exists('cache_get');
  }
  return $state;
}

Figured that since the Memcache setup lines in settings.php came before the Domain Access settings.inc inclusion, cache_get() would already be defined by this point so domain_settings_setup_ok() is going to return FALSE, therefore i reversed the test for it.

Domain Access now bootstraps fine on my installation and everything seems to work ok so far on my test site with Domain Access handling 2 domains.

--Drupal throws up lots of errors when i try to include the Domain Access settings.inc before the Memcache inclusions. Keeping the settings.inc inclusion last with that change in domain_settings_setup_ok() is working for me.

Comments

ben soo’s picture

--i already reported this to the Memcache API issue queue.

agentrickard’s picture

Status: Active » Needs review

We may be able to remove these lines entirely. They were a protection in D6 but may be clutter in D7.

agentrickard’s picture

At the least, perhaps, we change to see that $conf['cache_include'] hasn't been altered before running this check.

agentrickard’s picture

StatusFileSize
new1.67 KB
new1.7 KB

This might also affect 6.x.

Patches for 7.x.2 and 7.x.3 attached.

agentrickard’s picture

Priority: Normal » Major
ben soo’s picture

Unfortch nope that didn't work for me. Same error:

Domain access failed to load during phase: 2. Please check your settings.php file and site

V7.x.3 patch didn't apply. The one that applied cleanly, with one line offset, was the V7.x.2 patch even tho i'm running the latest V7.x.3 from the module page here dated Jul.7. Straight from install settings.inc is dated 2008-10-06.

--Thank you for the fast response btw. i appreciate it very much and remember that from way back when i was messing with D5 you were just as quick with issues.

ben soo’s picture

--any debugging you want me to do i'll comply-- proviso being i'm not a PHP dev as you folks certainly are so haven't any tools to use and remain clueless abt them.

agentrickard’s picture

How are you instantiating the memcache include?

/me doesn't have memcache.

agentrickard’s picture

StatusFileSize
new1.67 KB

Bad var name. See https://drupal.org/node/1131468.

New patch against 7.x.3. You may have to do a git pull first, since I committed two other patches today.

ben soo’s picture

Memcache API requires these 2 includes to work.

/*  D7 memcache includes */

// the path to the core cache file
include_once('./includes/cache.inc');

// the path to the memcache cache file
include_once('./sites/all/modules/memcache/memcache.inc');

/* end D7 memcache includes */

There are other directives but they for setting a default class for talking to the memcached daemon, and to configure the PHP memcache extension.

The above inclusions need to be above the Domain Access include or else Drupal throws up a lot of errors.

ben soo’s picture

i too clueless to describe that correctly. The other directives are like this:

$conf = array(
   'cache_default_class' => 'MemCacheDrupal',
   'memcache_key_prefix' => 'd7mytestsite',
   'memcache_servers' => array('XXX.XXX.XXX.XXX:11211' => 'default'),
   'memcache_bins' => array('cache' => 'default'),
   );

/* don't use binary protocol for now */
#$conf['memcache_options'] = array(
#  Memcached::OPT_BINARY_PROTOCOL => TRUE,
#);
ben soo’s picture

These are the errors i see when i put the Domain Access inclusion before the Memcache API ones:

    Notice: Undefined index: access in _menu_link_translate() (line 913 of /www/docs/d7test/includes/menu.inc).
    Notice: Undefined index: access in _menu_tree_check_access() (line 1446 of /www/docs/d7test/includes/menu.inc).
    Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 54 of /www/docs/d7test/sites/all/modules/entitycache/entitycache.module).
    Notice: Trying to get property of non-object in require() (line 397 of /www/docs/d7test/sites/all/modules/advanced_forum/includes/views/advanced_forum_unanswered_topics.view).
    Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 54 of /www/docs/d7test/sites/all/modules/entitycache/entitycache.module).
    Notice: Trying to get property of non-object in require() (line 420 of /www/docs/d7test/sites/all/modules/advanced_forum/includes/views/advanced_forum_active_topics.view).
    Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 54 of /www/docs/d7test/sites/all/modules/entitycache/entitycache.module).
    Notice: Trying to get property of non-object in require() (line 398 of /www/docs/d7test/sites/all/modules/advanced_forum/includes/views/advanced_forum_new_topics.view).
    Domain access failed to load during phase: 2. Please check your settings.php file and site configuration.
ben soo’s picture

i pulled and installed the latest V7.x.3.

This new patch doesn't work: if i reverse this test by removing the "!" then it loads.

if (!empty($conf['cache_inc'])) {

altho i'm seeing this error here and there in the admin pages, /admin/appearance in this case:

Notice: Undefined index: access in _menu_link_translate() (line 913 of /d7root/includes/menu.inc).
Notice: Undefined index: access in _menu_tree_check_access() (line 1446 of /d7root/includes/menu.inc).

Same error whether or not Memcache is installed.

ben soo’s picture

--on the plus side, i'm suddenly seeing the Color Picker in appearance/settings/themename where before it wasn't there! i dunno whether to attribute this to the latest V7.x.3, my installation is very much in flux.

ben soo’s picture

Stranger and stranger: i turned on a different PHP memcache extension (there're 2), and now these errors are gone.

Then i turned it off again leaving the old one, and those errors do not return.

OK, going to go do some other Drupally thing the rest of the day. This is messing with my head.

agentrickard’s picture

We probably just need to remove this check, then. The directive I was using is what's in the Memcache documentation, which is obviously out of date for Drupal 7.

agentrickard’s picture

StatusFileSize
new2.43 KB

And a patch that removes that function.

NOTE: When a patch fails to resolve the issue, please set the issue to "Needs work".

ben soo’s picture

Works!!!!!

!!!!!!!

Thank you agentrickard.

Am deep in the theming and site organisation, but after that i'll have to integrate multi-domains the way we need it, with every site's new content collected into one main front page, some common pages and a few shared areas and the possibility for users to register on multiple sites.

i'm sure at that point i'll be bugging you again. Hopefully i'll've figured enough out by then to leave out newbie stuff.

The other cache module i like is the D7 File Cache. That's pretty trouble free so far except it uses the same file system as everything else and that mightn't be a good idea for me once the load ramps up.
Will see.

Thanks again.

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

I'm going to commit this.

agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x.3 and 7.x.2

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gastonia’s picture

Status: Closed (fixed) » Active

Could this still be an issue? As of drupal 7.19, I get different errors depending on where I place the memcache settings in relation to domain access settings file. For example

1) I get this error when I place memcache settings after domain settings at the end of the file:
"The form has become outdated. Copy any unsaved work in the form below and then reload this page."

This happens on all pages.

Also, regardless of what theme I have enabled under Appearance Bartik loads, and, even under appearance shows it as the default theme (when I remove it, everything goes back to the previous settings for the custom theme.)

2) When I place it immediately before domain settings, I get a WSOD. When I run drush cc all I get "Drush terminated to to an unrecoverable error." .. and no more info.

3) When I move memcache settings to the top of the settings.php file so that it loads before any other $conf array settings, the error goes away and the theme loads correctly.

In 3) it appears to be working, but I am wary. If it were truly working as it should, then why would it matter where the memcache settings are placed so long as they are before domain settings?

Memcache and domain are the only things I have added to the default settings.php file.

agentrickard’s picture

By default, the $conf array is instantiated when settings.php is loaded, and there are settings hardcoded in lines 505-507, so my assumption is that memcache settings should go before DA settings, but they shouldn't need to be at the very top.

What is the memcache code that you add?

Gastonia’s picture

Memcache code

// the path to the core cache file
include_once('./includes/cache.inc');
// the path to the memcache cache file
include_once('./sites/all/modules/memcache/memcache.inc');
// make MemCacheDrupal the default cache class
$conf = array(
  'cache_default_class' => 'MemCacheDrupal',
  'memcache_servers' => array('127.0.0.1:11211' => 'default'),
  'memcache_bins' => array('cache' => 'default')
);
$conf['memcache_key_prefix'] = 'tourismbuilder23152';

The above was taken from the memcache instructions. I personally added the memcache_key_prefix to deal with a shared environment, but even if I delete that line the results are the same. Let me know what other info I can provide.

agentrickard’s picture

Try not defining $conf as an array. I think you are destroying needed settings.

Use this syntax for each item:

$conf['memcache_key_prefix'] = 'tourismbuilder23152';

If that works, it may be a bug in the memcache documentation.

Gastonia’s picture

Status: Active » Closed (fixed)

Gosh, I completely missed that I was reinstantiating the array. The new syntax works great, thanks for catching that. I'll add to the memcache issue queue for a doc update.