大网数据广告活动
服务器运维问答

How can I get my mediawiki to stop thinking I have cookies disabled?

· 52CE 我爱测

I've searched half a day for how to resolve this issue, and can't figure it out. Shortly after I made my wiki a simple private wiki according to the instructions at Mediawiki's website, it started giving me this weird login error…

问题原文

原帖链接 · PakG1 · CC BY-SA 3.0

I've searched half a day for how to resolve this issue, and can't figure it out. Shortly after I made my wiki a simple private wiki according to the instructions at Mediawiki's website, it started giving me this weird login error message: Wiki uses cookies to log in users. You have cookies disabled. Please enable them and try again.

If I remove those private wiki settings, the error disappears, even if I try logging in. But I need it to be a private wiki for only my team. So what do I do?

Here's what I've done so far. Just to be safe, after ever change, I try rebooting Apache using:

  • sudo /etc/init.d/apache2 restart

In my php.ini file, I have the following set:

  • session.save_path = "/var/lib/php5"
  • session.cookie_secure = secure
  • session.cookie_path = /tmp session.cookie_domain = my server's internal URL (should I even set this? this field was blank before, but not commented out)
  • session.referer_check = Off

I ran the following to ensure that the folders are writable:

  • sudo chmod -R 1777 /var/lib/php5
  • sudo chmod -R 1777 /tmp

In my LocalSettings.php file, I have the following added to the bottom of the settings file:

  • session_save_path("tmp");
  • $wgSessionsInObjectCache = true;
  • $wgMainCacheType = CACHE_ANYTHING;
  • $wgDebugToolbar = true;
  • $wgDebugLogFile='/var/log/mediawiki/mediawiki.log';
  • $wgShowExceptionDetails = true;
  • $wgShowDebug = true;
  • $wgDevelopmentWarnings = true;

For the above tmp, I created the folder /etc/mediawiki/tmp and also ran the following:

  • sudo chmod -R 1777 /etc/mediawiki/tmp

I know that the cookie is coming through to the browser because I can see the cookie in Firebug and verify that the same cookie got created in the /tmp folder.

SSL seems to be configured properly, because I get the green lock.

This is my debug output after trying to log in:

Debug data:

  • Start request

  • POST /mediawiki/index.php?title=Special:UserLogin&action=submitlogin&type=login&returnto=Special:RecentChanges

  • HTTP HEADERS:
  • HOST: bs-wiki.sis.org.cn
  • CONNECTION: keep-alive
  • CONTENT-LENGTH: 122
  • CACHE-CONTROL: max-age=0
  • ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
  • ORIGIN: https://bs-wiki.sis.org.cn
  • UPGRADE-INSECURE-REQUESTS: 1
  • USER-AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36
  • CONTENT-TYPE: application/x-www-form-urlencoded
  • DNT: 1
  • REFERER: https://bs-wiki.sis.org.cn/mediawiki/index.php?title=Special:UserLogin&returnto=Special%3ARecentChanges&returntoquery=
  • ACCEPT-ENCODING: gzip, deflate
  • ACCEPT-LANGUAGE: en-US,en;q=0.8
  • COOKIE: __gads=ID=f46767e352615a06:T=1453974579:S=ALNI_MaImAtsIj8Xb-3kERZtmSWx82DxNA; bs_wikiUserName=Rpark1; bs_wikiLoggedOut=20160128105049; bs_wiki_session=3fck92pn1uq1l1s852oq6rfdl3

  • CACHES: SqlBagOStuff[main] SqlBagOStuff[message] SqlBagOStuff[parser]

  • Connecting to localhost bs_wiki...
  • Profiler::instance called without $wgProfiler['class'] set, falling back to ProfilerStub for safety
  • Connected to localhost bs_wiki.
  • Connecting to localhost bs_wiki...
  • Connected to localhost bs_wiki.
  • DatabaseBase::query: Writes done: DELETE FROM objectcache WHERE keyname = 'bs_wiki:stats:request_with_session'
  • LocalisationCache: using store LCStore_DB
  • Unstubbing $wgParser on call of $wgParser::setFunctionHook from unknown
  • Parser: using preprocessor: Preprocessor_DOM
  • Fully initialised
  • Unstubbing $wgAuth on call of $wgAuth::validDomain from unknown
  • IP: 172.18.12.59
  • MessageCache::load: Loading en... got from global cache
  • Unstubbing $wgLang on call of $wgLang::_unstub from unknown
  • MWCryptRand::realGenerate: Generating cryptographic random bytes for LoginForm::setLoginToken/MWCryptRand::generateHex/MWCryptRand::realGenerateHex/MWCryptRand::generate/MWCryptRand::realGenerate
  • MWCryptRand::realGenerate: openssl_random_pseudo_bytes generated 16 bytes of strong randomness.
  • MWCryptRand::realGenerate: 0 bytes of randomness leftover in the buffer.
  • Class SkinVector not found; skipped loading
  • Class PEAR_Error not found; skipped loading

已采纳解答

原帖链接 · PakG1 · CC BY-SA 3.0

No idea why it works now, but started from scratch and went back to the original instructions at https://www.mediawiki.org/wiki/Manual:Preventing_access#Simple_private_wiki and now it works.

Well, not completely from scratch, I didn't revert my changes to php.ini. So not sure whether or not that fixed it. Either way, it's working now, and so I'm happy.... :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。