2

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
  • 31
  • 6

3 Answers3

1

Basd82 elsewhere reports that you have to set session.referer_check = Off in php.ini.

session_save_path("tmp") is surely wrong, your directory is called /tmp. (If you followed JesseG17's advice, you forgot step 3.) However, with $wgSessionsInObjectCache = true the session.save_path should be irrelevant.

You have $wgMainCacheType = CACHE_ANYTHING, but did you check that the cache actually works? Follow the cache manual and install appropriate object caching (that's always a good idea).

Nemo
  • 259
  • 1
  • 13
  • Sad to say that I started from scratch and went back to the original instructions at https://www.mediawiki.org/wiki/Manual:Preventing_access#Simple_private_wiki . Nothing changed from the first time I tried it, but it's working now. No idea why, guess don't care either.... :) Sorry, can't provide feedback on whether your advice worked or not. – PakG1 Feb 15 '16 at 07:15
1

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.... :)

PakG1
  • 31
  • 6
0

I just had the same problem - here the server had run out of disk space. Clearing up some space did the trick.

sonicwave
  • 136
  • 3