Project:Support desk

About this board

Welcome to MediaWiki.org's Support desk, where you can ask MediaWiki questions!

There are also other places where to ask :

Before you post

Post a new question

  1. To help us answer your questions, please always indicate which versions you are using (reported by your wiki's Special:Version page):
    • MediaWiki
    • PHP
    • Database
  2. Please include the URL of your wiki unless you absolutely can't. It's often a lot easier for us to identify the source of the problem if we can look for ourselves.
  3. To start a new thread, click "Start a new topic".
Previous page history was archived for backup purposes at Project:Support_desk/old on 2015-07-30.
 

Is there a reason why the web installer doesn't just write the LocalSettings.php file for you?

2
Ataaseq (talkcontribs)

I have often wondered why the MediaWiki web installer makes you download LocalSettings.php and upload it yourself instead of just writing the file to the web server for you. Does anyone know why this is the case?

Bawolff (talkcontribs)

the old installer (pre 1.16) did this.

Its to promote security best practise - its best if the webserver doesn't have write access to any file that gets executed. This helps in the case that a hacker finds some vulnerability. We dont create the file in order to encourage people to set up their webserver so that creating the file is impossible.

Reply to "Is there a reason why the web installer doesn't just write the LocalSettings.php file for you?"

How to move MediaWiki installation from LocalHost to domain name

3
IBBishops (talkcontribs)

I have a local installation of MediaWiki installed using WampServer; my next step is to move it to a domain name so that it will be visible on the search engines; I did some Googling for instructions on how to do this, but didn't find any specifically for MediaWiki, if you could help me or point me in the right direction I would be grateful.~~~~

Bawolff (talkcontribs)

you need to change $wgServer in LocalSettings.php to be new domain name. Otherwise everything is identical to any other webserver.

IBBishops (talkcontribs)

Thanks.

Reply to "How to move MediaWiki installation from LocalHost to domain name"

Delete hundreds of spam users

4
PelicanGaming (talkcontribs)

How do I bulk delete hundreds of spam user accounts? I've managed to stop them being created and stop them from making junk pages, but I want to get rid of the user accounts without having to click on each one to block.

MarcoAurelio (talkcontribs)
PelicanGaming (talkcontribs)

@MarcoAurelio

That's grabbing only recent contributions (nothing), it's not grabbing the hundreds of users that I stopped over a year ago....

Malyacko (talkcontribs)
Reply to "Delete hundreds of spam users"

fileinfo - MW 1.34 internal error

10
DOSSOD (talkcontribs)

I'm receiving a MW 1.34 internal error; required components "fileinfo"

FileInfo folder containing Fileinfo.php, FileInfoi18nmagic.php are under the wiki/ extensions location and the php_fileinfo.dll extension in php.ini is enabled. I'm not sure what else I'm missing.


MS Visual C++ 2019

PHP 7.2.31

MySQL 5.7.17

Ciencia Al Poder (talkcontribs)

Look at the output of phpinfo(); as described in Manual:php.ini, to see if it's really enabled and on which php.ini.

DOSSOD (talkcontribs)

I have made a search and found, php.ini.

I also looked at the phpinfo.php via browser. The Configuration File (php.ini) path only says: C:\Windows, where the loaded configuration path actually shows where the pp.ini file is located.


the following are set:

extension_dir= "ext"

extension=fileinfo


looks like that's all what is needed but I'm still getting a error, even when I cmd > iisreset

Ciencia Al Poder (talkcontribs)

phpinfo also displays the list of loaded extensions. If fileinfo is not listed as installed, something is not set correctly in your php.ini.

Note that you may need to restart the webserver in order to changes to php.ini files take effect

DOSSOD (talkcontribs)

FileInfo was not listed, WinCache was also not listed. Not sure but I'll look over it again .... otherwise there shouldn't be anything else outside the phpini that needs to be set, correct?


Interesting is when I delete all WikiMedia 1.34. files and copy WikiMedia 1.25 file into the wiki folder, the fileinfo error doesn't appear and I see the wikimedia installation page.

DOSSOD (talkcontribs)

Do I need the GNU file package for windows from here: http://gnuwin32.sourceforge.net/downlinks/file-bin-zip.php


The Instructions says to extract the folder from the archive called shared\file which contains 4 magic files (magic, magic.mgc, magic.mime, magic.mime.mgc) but there are only two files in the zip file (FileInfo.i18n.magic.php, FileInfo.php)...

Ciencia Al Poder (talkcontribs)
DOSSOD (talkcontribs)

Ok. I'm going to reinstall PHP again then. For MW 1.34, what PHP version would you recommend then?

Ciencia Al Poder (talkcontribs)
DOSSOD (talkcontribs)

I followed these instructions.

MS Visual C++ 2019

PHP 7.3.20

MySWL 5.7.17

MW 1.34.1


opening the wiki media installation page, tells me "required components missing (mbstring, fileinfo)

These dll's are in the ./ext folder. Do I have to install them manually? php.ini shows them as enabled.

    • mbstring (required since 1.27, recommended for earlier versions)
    • fileinfo (required since 1.30)
  • Note that all of these are enabled in PHP by default.
Reply to "fileinfo - MW 1.34 internal error"

How do I prevent spammers from adding to my wiki?

2
Newman2 (talkcontribs)

Hello. I have been working on a wiki family, and the main issue is that spammers are adding their own pages to the main wiki and (sometimes) creating loads of accounts. I have tried CAPTCHA and my abuse filter isn't working at the moment, and more spam accounts have continued to add pages to my wiki.

I am worried that this might use up disk usage. Is there a way to stop spam from appearing on my wiki(s)?

PelicanGaming (talkcontribs)

I dealt with this a year ago, I think it was under the Special Pages and Users section, somewhere, to turn off allowing anyone to create an account. But I'm not finding it as I'm looking.....

It might have been a coding change in one of the system pages. I know I found the solution here somewhere....


I think I found what I did. Open the LocalSetting.php in your html editor portion of your webhost file manager. Down at the bottom is a bit on users. I set my code to the following:

# Disable anonymous editing

$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops

$wgGroupPermissions['*']['createaccount'] = false;

$wgGroupPermissions['*']['edit'] = false;

$wgGroupPermissions['user']['edit'] = true;

$wgGroupPermissions['sysop']['edit'] = true;


I'm currently trying to figure out how to delete the hundreds of accounts. It took a long time to delete all the pages...

Good luck!!!!!

Reply to "How do I prevent spammers from adding to my wiki?"

How do I remove stuff from the sidebar?

4
SteveRMann (talkcontribs)

My default sidebar contains "what links here" and "related changes" and others links that I don't want every user to see. How do I delete them or hide them from most users?

The page at MediaWiki:Sidebar&action=edit just gives me control of the link items at the top of the sidebar.

From the Version page:

Installed software

Product Version: MediaWiki 1.21.1

PHP 5.3.24 (cgi-fcgi)

MySQL 5.0.96-log

Article path /wiki/index.php?title=$1

Script path /wiki

index.php /wiki/index.php

api.php /wiki/api.php

load.php /wiki/load.php

88.130.73.233 (talkcontribs)

Unrelated to your request, for the security of your own data, you should upgrade MediaWiki to a supported version.

Generally, you can change the contents of the sidebar by editing the wiki page MediaWiki:Sidebar in your wiki. For details see Manual:Interface/Sidebar.

I think the links in the Tools menu might be hardcoded. User Seb35 has some code, which has to go into the LocalSettings.php file, see User:Seb35/modifyToolbox#Code. I have not tested this code, but basically with something like this it should be possible to hide also parts of the Tools menu.

Another, more simple approach might be to hide certain items via CSS. But this will then only be possible for all users. Not for some as you want it to.

SteveRMann (talkcontribs)

Thanks - I suspected it was hard-coded as grep couldn't find anything that looked like one of the links there. I am using GoDaddy and can only install what they offer, which is currently V1.21.1.

Moscowdreams (talkcontribs)

Import failed: Expected <mediawiki> tag, got

9
86.48.98.98 (talkcontribs)

Hi there

I'm in the middle of a migration from Screwturn to Mediawiki, but the bulk importer doesn't seem to want to play nice.


My Mediawiki is 1.34.2 and PHP is 7.4.7, IIS is 10.


I have wasted a lot of time with the import function, thinking that it was the syntax or other issues carried over from the export of Screwturn.

I used this converter btw: https://github.com/Cyberitas/ScrewturnToMediawiki


In my latest test, I had exportet 2 working pages from mediawiki, which I created myself, put them in a bz2 archive and tried importing them to the same wiki. I also get the error in the topic when doing so, which leaves me baffled..


These are the php errors:

[06-Jul-2020 12:50:54 Europe/Copenhagen] PHP Warning:  XMLReader::read(): uploadsource://0186662cb5a76f3d3d244da07a4070fe:1: parser error : Document is empty in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

[06-Jul-2020 12:50:54 Europe/Copenhagen] PHP Warning:  XMLReader::read(): BZh91AY&amp;SY�=�� in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

[06-Jul-2020 12:50:54 Europe/Copenhagen] PHP Warning:  XMLReader::read(): ^ in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

[06-Jul-2020 13:01:47 Europe/Copenhagen] PHP Warning:  XMLReader::read(): uploadsource://40dc1c20a94f2ca42e01a959344381ae:1: parser error : Document is empty in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

[06-Jul-2020 13:01:47 Europe/Copenhagen] PHP Warning:  XMLReader::read(): BZh91AY&amp;SY�=�� in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

[06-Jul-2020 13:01:47 Europe/Copenhagen] PHP Warning:  XMLReader::read(): ^ in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570


Please let me know where to find other useful logs, thank you for your time!

Majavah (talkcontribs)

Are you using importDump.php or Special:Import? If importDump.php, what exact command are you using to import the file?

86.48.98.98 (talkcontribs)

Hi Majavah


Thanks, good point - I was blinded by the same error message from the Special:Import, so I didn't test the mediawiki export in the commandline.. It worked there...


Here are my tests with only a few converted xml files in the tar.bz2:

c:\Program Files\PHP\v7.4.7>php C:\inetpub\Wiki\maintenance\importDump.php --conf C:\inetpub\Wiki\LocalSettings.php C:\Users\hj_adm\Desktop\Desktop.tar.bz2

Warning: XMLReader::read(): uploadsource://0cc83551072289c1540745a8ff28e526:1: parser error : Document is empty in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

Warning: XMLReader::read(): agents.xml in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

Warning: XMLReader::read(): ^ in C:\inetpub\Wiki\includes\import\WikiImporter.php on line 570

MWException from line 574 of C:\inetpub\Wiki\includes\import\WikiImporter.php: Expected <mediawiki> tag, got

#0 C:\inetpub\Wiki\maintenance\importDump.php(359): WikiImporter->doImport()

#1 C:\inetpub\Wiki\maintenance\importDump.php(292): BackupReader->importFromHandle(Resource id #150)

#2 C:\inetpub\Wiki\maintenance\importDump.php(127): BackupReader->importFromFile('compress.bzip2:...')

#3 C:\inetpub\Wiki\maintenance\doMaintenance.php(99): BackupReader->execute()

#4 C:\inetpub\Wiki\maintenance\importDump.php(364): require_once('C:\\inetpub\\Wiki...')

#5 {main}


They all work individually, the ones I have checked at least.

Majavah (talkcontribs)

I don't think the script can read bzipped files, try giving it the path to the raw XML file

86.48.98.98 (talkcontribs)

Hi again, and thank you for your time!


It worked .. So why would the official documentation point to an archive? :D

php importDump.php --conf ../LocalSettings.php /path_to/dumpfile.xml.gz


Well, since that doesn't help me, do you have a pointer as to importing multiple xml files? :)

Majavah (talkcontribs)

The documentation states "If the file is compressed and that has a .gz or .bz2 file extension, it is decompressed automatically.". My guess would be that it only .bz2 files, not .tar.bz2. I'll do some digging and update the documentation.

86.48.98.98 (talkcontribs)

I tried both with archives made in 7-zip (first tar, then bz2 from the tar) and directly to bz2 on Ubuntu via tar tool..


Guess I'll just build a long list of single import commands and get it overwith ... =)

Thank you so much for your time

Bawolff (talkcontribs)

it probably also depends if your version of php is compiled with bz2 support (i would guess)

86.48.98.98 (talkcontribs)

Hi Bawolf

It is an enabled extension on my PHP, so no worries there :)

I ended up importing 1 page/xml at a time, which was about 300 oneliners, but we're up and running!

Thanks for the quick support, you guys are amazing!

Reply to "Import failed: Expected <mediawiki> tag, got"

я не хочу работать под студией я хочу создать бесплатный аккаунт

1
92.127.187.127 (talkcontribs)

я не хочу работать под студией я хочу создать бесплатный аккаунт

Reply to "я не хочу работать под студией я хочу создать бесплатный аккаунт"

Mediawiki makes Apache2 Seg-fault

3
Zapane (talkcontribs)

I just migrated my wiki to a brand new install on ubuntu20 with

MediaWiki1.31.7

PHP7.4.3 (apache2handler)

MariaDB10.3.22-MariaDB-1ubuntu1

Everything seemed to work fine except for one thing:

If I click on a diff-link in the version history of any page, i get a "zero-sized-reply" in the browser and in the apache2 error.log i get a line like this:

[Tue Jul 07 16:48:52.619894 2020] [core:notice] [pid 1345] AH00051: child pid 274938 exit signal Segmentation fault (11), possible coredump in /etc/apache2

(there is no core-dump in /etc/apache2)


Any ideas?

Malyacko (talkcontribs)

@Zapane Ask in an Apache forum how to get a stacktrace/coredump of the Apache segfault, as this is not a MediaWiki problem.

Bawolff (talkcontribs)

the segfault will probably be in php not apache.

most likely you have no core dump because apache does not have permission to write to /etc/apache.

There is not much we can do about this. If you could minimize the reproduction case that would be helpful.

Reply to "Mediawiki makes Apache2 Seg-fault"

Escape pipe charachter in parser function

3
Summary by Waanders

Using {{!}} does the trick.

Waanders (talkcontribs)

How do I escape a pipe character using a parser function?


Replacing a backslash by a hyphen can be like this:

{{#vardefine:varName|test\test\test}}

{{#vardefine:varName2|{{#replace:{{#var:varName}}|\|-}}}}

{{#var:varName2}}


But replacing a pipe character ...?

Majavah (talkcontribs)

You can use {{!}}

Waanders (talkcontribs)

That works! Thanks a lot.