Essentially if you implement the final optional lines in the Readme everything works great for authenticated users but unauthenicated users get a failure:
Fatal error: Call to undefined function db_query() in /var/www/includes/ on line 335
Call Stack
# Time Memory Function Location
1 0.0002 656240 {main}( ) ../index.php:0
2 0.0104 737664 drupal_bootstrap( ) ../index.php:20
3 0.0177 760192 _drupal_bootstrap_page_cache( ) ../
4 0.0182 782672 drupal_page_get_cache( ) ../
5 0.0182 783504 cache_get( ) ../
6 0.0182 784384 DrupalDatabaseCache->get( ) ../
7 0.0182 784816 DrupalDatabaseCache->getMultiple( ) ../


R.Muilwijk’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please provide more information. I was not able to reproduce.

mbinde’s picture

Same error here. Removing the final optional lines from the Readme solved it as well.

Not sure what information is useful, but: Ubuntu 10.04, apc package, Drupal 7.7.

travelertt’s picture

Same error. "Call to undefined function db_query() in [\drupal\includes\] on line 335".

Windows Server 2003
Drupal 7.7

Removed the two optional lines and site came back up. Was working for authenticated users, soon as I signed out as USER1 account all pages returned White screen of death with that error.

travelertt’s picture

Title: Anonamous users get failure if page_cache_without_database = TRUE and page_cache_invoke_hooks = FALSE » Anonymous users get failure if page_cache_without_database = TRUE and page_cache_invoke_hooks = FALSE
dropbydrop’s picture

I had the same problem as other people and it broke a site.

The module needs maintenance. It's another essential module for D7 that is slow to have a stable release.

ASupinski’s picture

Component: Code » Documentation
Priority: Critical » Minor
Status: Postponed (maintainer needs more info) » Needs work

I've come around to this and discovered that this is really a user not comprehending the documentation issue (sorry) , anonymous users will get this error if the setting

$conf['page_cache_without_database'] = TRUE; 

is set without also including this setting

$conf['cache_class_cache_page'] = DrupalAPCCache;

or some other non-database caching being set for the page cache.

This is spelled out in the readme but I suppose could be spelled out more explicitly.

dropbydrop’s picture

can i use this in combination with varnish cache?

JGO’s picture

Hmm not sure, I get a blank page with this config on D7 as soon as the page is visited after the first time (so 1st time ok, afterwards blank):

	$conf['cache_backends'] = array('sites/all/modules/apc/');
	// Use APC by default (cache everything.)
	$conf['cache_default_class'] = 'DrupalAPCCache';
	// Page cache without database and module hooks
	$conf['page_cache_invoke_hooks'] = FALSE;
	$conf['page_cache_without_database'] = TRUE;

This works without problems though:

	$conf['cache_backends'] = array('sites/all/modules/apc/');
	// Use APC by default (cache everything.)
	$conf['cache_default_class'] = 'DrupalAPCCache';
	// Page cache without database and module hooks
	$conf['page_cache_invoke_hooks'] = FALSE;
	$conf['page_cache_without_database'] = FALSE;

BTW using: 7.x-1.0-beta3, should I try latest dev ??

R.Muilwijk’s picture

Status: Needs work » Postponed (maintainer needs more info)

As you can see the error is in a database query. So something has went wrong with loading the correct cache backend.

Heine’s picture

Status: Postponed (maintainer needs more info) » Active

This is due to a bug in Drupal core. I'll open a separate report in the core queue and keep this one here to allow people to find it and/or allow Raymond to add instructions to README.txt.

The root cause:

Variables are not loaded when serving a cache hit when page_cache_without_database = TRUE. Variables are loaded when the caching system needs to serve a cache miss. This causes an 'impedance mismatch' between the code that fetches and serves a page from cache and code that saves a page to cache when the variable page_compression is set to FALSE in the interface;

Upon serving a cache miss, page_compression = FALSE and an uncompressed page is saved to cache
Upon serving a cache hit, page_compression has its default value TRUE and drupal_serve_page_from_cache serves the uncompressed data with a Content-Encoding: gzip header. Browsers do not appreciate this.

Possible workarounds:

  • Check the setting Compress cached pages on admin/config/development/performance
  • Set page_compresssion to FALSE in settings.php's conf array.
Heine’s picture

Status: Active » Closed (won't fix)

We can safely won't fix here; see #11 for the core issue.

Exploratus’s picture

This is still a problem, at least for me. I dont understand how people are using this module for anonymous users? Is this only happening to some people, or are most just not adding the last couple of lines to settings.php?

Heine’s picture

Exploratus, you need to either enable page compression or set the page_compression variable to FALSE in settings.php. See #11.

Exploratus’s picture

So will this only work without gzip compression?

henkit’s picture

Do you perhaps have domain access enabled?

If i put the apc settings below the domain access it works...but then update is not working.

emmonsaz’s picture

#6 solution worked for me (after changing the value to a string):

* Add APC Caching.
$conf['cache_backends'][] = 'sites/all/modules/apc/';
$conf['cache_class_cache'] = 'DrupalAPCCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalAPCCache';
//$conf['apc_show_debug'] = TRUE; // Remove the slashes to use debug mode.
$conf['cache_class_cache_page'] = 'DrupalAPCCache';
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;