【发布时间】:2015-12-25 19:47:12
【问题描述】:
在 settings.php 中,你必须输入与 settings.php 类似的代码。
我在 nginx 日志文件中收到一个错误,显示它找不到 DrupalMongoDBCache 的路径。
FastCGI 在标准错误中发送:“PHP 消息:PHP 致命错误:在 /var/www/drupal-test/includes/cache.inc 中找不到类 'DrupalMongoDBCache'
如果我准确地更改以下路径,那么我会得到一个不同的错误:
$conf['cache_backends'][] = '/var/www/drupal-test/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['session_inc'] = '/var/www/drupal-test/sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
FastCGI 在 stderr 中发送:“PHP 消息:PHP 致命错误:require_once(): Failed opening required ' /var/www/drupal-test/ drupal-test/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc'
注意它会复制相同的起始路径两次。为什么!?我需要 php 才能进入正确的目录,以免出现这个 500 内部错误问题。 请帮忙=)
将代码复制到settings.php:
#MongoDB
$conf['mongodb_connections'] = array(
'default' => array( // Connection name/alias
'host' => 'localhost', // Omit USER:PASS@ if Mongo isn't configured to use authentication.
'db' => 'tomsadvice-mongodb' // Database name. Make something up, mongodb will automatically create the database.
),
);
include_once('.includes/cache.inc');
# -- Configure Cache
$conf['cache_backends'][] = 'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['cache_class_cache'] = 'DrupalMongoDBCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
$conf['cache_default_class'] = 'DrupalMongoDBCache';
# -- Don't touch SQL if in Cache
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
# Session Caching
$conf['session_inc'] = 'sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
$conf['cache_session'] = 'DrupalMongoDBCache';
# Field Storage
$conf['field_storage_default'] = 'mongodb_field_storage';
# Message Queue
$conf['queue_default_class'] = 'MongoDBQueue';
?>
【问题讨论】:
标签: php mongodb drupal-modules