You are here

README.txt in File Cache 7

Same filename and directory in other branches
  1. 8 README.txt
  2. 5.5 README.txt
CONTENTS OF THIS FILE
---------------------
   
 * Introduction
 * Requirements
 * Installation
 * Configuration
  * Cache bins
  * Cache directory
  * Cache prefix
 * Uninstalling
 * Troubleshooting
 * Maintainers


INTRODUCTION
============

This modules allows Drupal cache bins to be stored in files instead of
storing in database.

 * For a full description of the module, visit the project page:
   https://drupal.org/project/filecache

 * To submit bug reports and feature suggestions, or to track changes:
   https://drupal.org/project/issues/filecache


REQUIREMENTS
============

No modules are required but for security reasons File Cache needs private
directory where to store files outside of webserver root.


INSTALLATION
============

Install and enable filecache module as usual. Add the following to site's
settings.php:

$conf['cache_backends'] = array('sites/all/modules/filecache/filecache.inc');
$conf['cache_default_class'] = 'DrupalFileCache';

You may need to adjust filecache.inc path if filecache is not installed globally.

Go to Status report page <admin/reports/status>. Run cron. Confirm that there
are no errors and there is only a warning for using the default location.

SECURITY NOTE: The default location depends on the webserver to deny web access
to directories that start with ".ht". Check if there is HTTP error 403 Forbidden
and if it is not, you MUST NOT LEAVE THE CONFIGURATION AS IS IN THIS CASE.

If directories starting with ".ht" are denied access to, you may safely follow
the instructions in Status report to remove the warning.

Apache webserver usually denies access to files and directories starting with
".ht". To configure the popular nginx webserver to do the same, add the following
lines to the server section:

location ~ /\.ht {
  deny all;
}


CONFIGURATION
=============

All configuration settings reside in settings.php.


CACHE BINS
----------

You can specify which class is used for each cache bin. File Cache class is
named DrupalFileCache and the quickstart configuration in Installation section
uses this class as default for all cache bins. You can set specific classes
for cache bins by using cache_class_CACHEBIN configuration setting. Example:

$conf['cache_default_class'] = 'DrupalFileCache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

The official documentation is located in
https://api.drupal.org/api/drupal/includes%21cache.inc/interface/DrupalCacheInterface/7.x


CACHE DIRECTORY
---------------

As explained in the Installation section, the cache directory must not be
accessible through the webserver. The configuration setting is named
filecache_directory and in the simple case, it is full path to a directory.
File Cache will try to create the directory for you. If you manually create it,
make sure that its owner is the same user as used by PHP, and its access mode
is 700 (owner can do anything, others are not allowed to access the directory).

If you want to have different directories for different cache bins,
the configuration setting should be array with cache bins as keys and directory
locations as values. The 'default' cache bin is used for all cache bins that
are not explicitly configured. You don't provide the name of the cache bin
as component in the pathname, because File Cache always creates subdirectory
for each cache bin. Example:

$conf['filecache_directory']['default'] = '/tmp/filecache';
$conf['filecache_directory']['cache'] = '/dev/shm/filecache';                                                                                                                                                                                                
$conf['filecache_directory']['cache_bootstrap'] = '/dev/shm/filecache';

Since directories are automatically created by File Cache, cleanup of these
directories on restart will recreate them by File Cache. Note that for some
Drupal sites /tmp may not have enough disk space. As explained in the next
subsection, cache bin directories by default have site-specific prefix and
you can provide the same directory for all your sites in multisite Drupal.


CACHE BIN PREFIX
----------------

File Cache supports the unified cache bin prefix proposal as described in
https://www.drupal.org/node/1324812 . By default, the result of conf_path()
is used with '/' replaced by '_'. For the default website, this means that
'sites_default_' is used as prefix for all cache bin directories inside
filecache_directory setting. Example from the proposal:

// Default prefix (all backends) no prefix if not set or set to FALSE:
$conf['cache_prefix']['default'] = 'someprefix_';
// Sample prefix for cache_page bin:
$conf['cache_prefix']['cache_page'] = 'otherprefix_';
// Force no prefix for the 'cache_bootstrap' bin:
$conf['cache_prefix']['cache_bootstrap'] = FALSE;

Setting global prefix without exceptions, like in filecache_directory, is also
supported:

$conf['cache_prefix'] = 'siteprefix_';

You can also remove the prefix for all cache bins:

$conf['cache_prefix'] = FALSE;


UNINSTALLING
============

File Cache tries its best to avoid problems when it is disabled in settings.php.
Please be sure to run cron after disabling File Cache in settings.php and before
disabling or uninstalling the module.


TROUBLESHOOTING
===============

You should check Status report page for self-checks by File Cache.

If you use Drush, File Cache detects that PHP CLI is used and doesn't allow
creating new files or directories. This is to avoid permission problems with
these created files/directories when they are accessed by webserver.


MAINTAINER
==========

Ognyan Kulev (ogi) - https://www.drupal.org/u/ogi

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Requirements
  5. * Installation
  6. * Configuration
  7. * Cache bins
  8. * Cache directory
  9. * Cache prefix
  10. * Uninstalling
  11. * Troubleshooting
  12. * Maintainers
  13. INTRODUCTION
  14. ============
  15. This modules allows Drupal cache bins to be stored in files instead of
  16. storing in database.
  17. * For a full description of the module, visit the project page:
  18. https://drupal.org/project/filecache
  19. * To submit bug reports and feature suggestions, or to track changes:
  20. https://drupal.org/project/issues/filecache
  21. REQUIREMENTS
  22. ============
  23. No modules are required but for security reasons File Cache needs private
  24. directory where to store files outside of webserver root.
  25. INSTALLATION
  26. ============
  27. Install and enable filecache module as usual. Add the following to site's
  28. settings.php:
  29. $conf['cache_backends'] = array('sites/all/modules/filecache/filecache.inc');
  30. $conf['cache_default_class'] = 'DrupalFileCache';
  31. You may need to adjust filecache.inc path if filecache is not installed globally.
  32. Go to Status report page . Run cron. Confirm that there
  33. are no errors and there is only a warning for using the default location.
  34. SECURITY NOTE: The default location depends on the webserver to deny web access
  35. to directories that start with ".ht". Check if there is HTTP error 403 Forbidden
  36. and if it is not, you MUST NOT LEAVE THE CONFIGURATION AS IS IN THIS CASE.
  37. If directories starting with ".ht" are denied access to, you may safely follow
  38. the instructions in Status report to remove the warning.
  39. Apache webserver usually denies access to files and directories starting with
  40. ".ht". To configure the popular nginx webserver to do the same, add the following
  41. lines to the server section:
  42. location ~ /\.ht {
  43. deny all;
  44. }
  45. CONFIGURATION
  46. =============
  47. All configuration settings reside in settings.php.
  48. CACHE BINS
  49. ----------
  50. You can specify which class is used for each cache bin. File Cache class is
  51. named DrupalFileCache and the quickstart configuration in Installation section
  52. uses this class as default for all cache bins. You can set specific classes
  53. for cache bins by using cache_class_CACHEBIN configuration setting. Example:
  54. $conf['cache_default_class'] = 'DrupalFileCache';
  55. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  56. The official documentation is located in
  57. https://api.drupal.org/api/drupal/includes%21cache.inc/interface/DrupalCacheInterface/7.x
  58. CACHE DIRECTORY
  59. ---------------
  60. As explained in the Installation section, the cache directory must not be
  61. accessible through the webserver. The configuration setting is named
  62. filecache_directory and in the simple case, it is full path to a directory.
  63. File Cache will try to create the directory for you. If you manually create it,
  64. make sure that its owner is the same user as used by PHP, and its access mode
  65. is 700 (owner can do anything, others are not allowed to access the directory).
  66. If you want to have different directories for different cache bins,
  67. the configuration setting should be array with cache bins as keys and directory
  68. locations as values. The 'default' cache bin is used for all cache bins that
  69. are not explicitly configured. You don't provide the name of the cache bin
  70. as component in the pathname, because File Cache always creates subdirectory
  71. for each cache bin. Example:
  72. $conf['filecache_directory']['default'] = '/tmp/filecache';
  73. $conf['filecache_directory']['cache'] = '/dev/shm/filecache';
  74. $conf['filecache_directory']['cache_bootstrap'] = '/dev/shm/filecache';
  75. Since directories are automatically created by File Cache, cleanup of these
  76. directories on restart will recreate them by File Cache. Note that for some
  77. Drupal sites /tmp may not have enough disk space. As explained in the next
  78. subsection, cache bin directories by default have site-specific prefix and
  79. you can provide the same directory for all your sites in multisite Drupal.
  80. CACHE BIN PREFIX
  81. ----------------
  82. File Cache supports the unified cache bin prefix proposal as described in
  83. https://www.drupal.org/node/1324812 . By default, the result of conf_path()
  84. is used with '/' replaced by '_'. For the default website, this means that
  85. 'sites_default_' is used as prefix for all cache bin directories inside
  86. filecache_directory setting. Example from the proposal:
  87. // Default prefix (all backends) no prefix if not set or set to FALSE:
  88. $conf['cache_prefix']['default'] = 'someprefix_';
  89. // Sample prefix for cache_page bin:
  90. $conf['cache_prefix']['cache_page'] = 'otherprefix_';
  91. // Force no prefix for the 'cache_bootstrap' bin:
  92. $conf['cache_prefix']['cache_bootstrap'] = FALSE;
  93. Setting global prefix without exceptions, like in filecache_directory, is also
  94. supported:
  95. $conf['cache_prefix'] = 'siteprefix_';
  96. You can also remove the prefix for all cache bins:
  97. $conf['cache_prefix'] = FALSE;
  98. UNINSTALLING
  99. ============
  100. File Cache tries its best to avoid problems when it is disabled in settings.php.
  101. Please be sure to run cron after disabling File Cache in settings.php and before
  102. disabling or uninstalling the module.
  103. TROUBLESHOOTING
  104. ===============
  105. You should check Status report page for self-checks by File Cache.
  106. If you use Drush, File Cache detects that PHP CLI is used and doesn't allow
  107. creating new files or directories. This is to avoid permission problems with
  108. these created files/directories when they are accessed by webserver.
  109. MAINTAINER
  110. ==========
  111. Ognyan Kulev (ogi) - https://www.drupal.org/u/ogi