Project:Support desk

About this board

Welcome to the MediaWiki Support desk, where you can ask MediaWiki questions!

(Read this message in a different language)

See also

Before you post

Post a new question

  1. To help us answer your questions, please indicate which versions you are using, as found on your wiki's Special:Version page:
    • MediaWiki version
    • PHP version
    • Database type and version
  2. Please include the web address (URL) to your wiki if possible. It's often easier for us to identify the source of the problem if we can see the error directly.
  3. To start a new thread, click "Start a new topic".

Short URL not working as expected

2
176.182.111.164 (talkcontribs)

I have an issue with short URLs, despite trying to follow the guide there.

My server is running Ubuntu 22.04.1 "jammy" and can be reached at https://ornans.wiki. I installed MediaWiki with apt install mediawiki and have the following software versions:

- dpkg -s mediawiki | grep Version returns Version: 1:1.35.6-1

- apache2 -v returns Server version: Apache/2.4.52 (Ubuntu)

- mysql --version returns mysql  Ver 8.0.30-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))


My MediaWiki install is located at /var/lib/mediawiki/ (so this is the location of my LocalSettings.php) and I made a symlink from /var/www/html to that folder (with the command ln -s /var/lib/mediawiki /var/www/html).

In my LocalSettings.php, wgScriptPath is set to "/mediawiki".


My Apache HTTPS config, located at /etc/apache2/sites-available/000-default.conf is:

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on

RewriteCond %{SERVER_NAME} =www.ornans.wiki [OR]

RewriteCond %{SERVER_NAME} =ornans.wiki

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

# Short URL for wiki pages

RewriteRule ^/?w(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]

# Redirect / to Main Page

RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]

</VirtualHost>


The HTTPS config, located at /etc/apache2/sites-available/000-default-le-ssl.conf is:

<IfModule mod_ssl.c>

<VirtualHost *:443>

any further virtual host explicitly.

ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /w /var/lib/mediawiki/index.php

# Enable the rewrite engine

RewriteEngine On

# Redirect / to Main Page

RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]

ServerName www.ornans.wiki

Include /etc/letsencrypt/options-ssl-apache.conf

ServerAlias ornans.wiki

SSLCertificateFile /etc/letsencrypt/live/www.ornans.wiki/fullchain.pem

SSLCertificateKeyFile /etc/letsencrypt/live/www.ornans.wiki/privkey.pem

</VirtualHost>

</IfModule>


I would like my wiki to be accessed at w, without any browser URL rewriting. This means that I would like to write ornans.wiki/w/My_Page and it should show the page "My Page" while the URL displayed in the URL bar in the browser stays the same.

Does anyone know what I need to change in order for my MediaWiki install to work as I expect?

Bawolff (talkcontribs)

Your apache config looks fine.

I think that your $wgArticlePath in LocalSettings.php is wrong. Try setting it to '/w/$1'

Reply to "Short URL not working as expected"
Vlad5250 (talkcontribs)

In "Page information", I can see "Recent number of edits". The interval for recent edits is the same as the maximum allowed value for "Days to show in recent changes" and "Days to show in watchlist" in Special:Preferences. The interval for recent edits is set 30 days on Wikimedia projects, and 5 years on translatewiki.net. Is it defined in $wgRCMaxAge, or another configuration setting?

Bawolff (talkcontribs)

I believe its set by the wgRCMaxAge setting.

Reply to "Recent number of edits"
FamousHz1 (talkcontribs)

Hello !!

I need to change the login page (so that the sidebar and the headerbar don't appear) but i can't find the page to change that.

156.8.246.10 (talkcontribs)

Which version are you using?

Bawolff (talkcontribs)
Reply to "Login Page"

non capisco come installare Mediawiki, non capisco come si fa

2
79.40.4.216 (talkcontribs)

per favore qualcuno mi aiuti

Malyacko (talkcontribs)
Reply to "non capisco come installare Mediawiki, non capisco come si fa"
Summary by Abrape

Very helpful. Problem solved. Many Thanks.

Abrape (talkcontribs)

Hello, I created a template infobox in my wiki. If I insert the info box with brackets in the lemma, the template appears correctly. After inserting the data, I save the lemma, but the info box remains empty (no data). How do I have to program the template so that the template is inserted into the lemma (without using subst) and the info box filled with data becomes visible in the lemma after saving? LG Abrape

Jonathan3 (talkcontribs)

I guess lemma is a word for page.

Copy and paste your page (at least the part calling the template) and your template here and we'll see!

Abrape (talkcontribs)
[[Datei:<Name>.png|thumb|center|<Berg>]]
Name =
Höhe in m ü. NHN =
Lage =
Gebirge =
Breitengrad =
Längengrad =
Typ =
Gestein =
Bauwerke =
Jonathan3 (talkcontribs)

Could you also copy and paste your page?

In the template, you need to add the parameters. E.g. it might have Name = {{{Name|}}} if your page has {{Templatename|Name=Joe Bloggs}}.

See Help:Templates#Parameters.

Abrape (talkcontribs)

Done. Thank you for your help!

[[Datei:<Name>.png|thumb|center|<Berg>]]
Name =
Höhe in m ü. NHN =
Lage =
Gebirge =
Breitengrad =
Längengrad =
Typ =
Gestein =
Bauwerke =
Jonathan3 (talkcontribs)

That looks like the Template page rather than the content page. Could you send both?

It's surrounded by noinclude tags. That tells mediawiki not to include the text between the tags when the template is used. You could change them to includeonly and see what difference it makes.

Also I wonder whether template parameters are case sensitive. I can't remember.

Abrape (talkcontribs)

The copy of the side box has no reference here and therefore only Template:Testberg appears here. Sorry!

Jonathan3 (talkcontribs)

I don't know what that means.

If you mean how it appears on this website, don't worry - I can click "edit" to see what you copy/pasted.

It would be good to see two things:

1. The name and content of the page containing the template code, e.g. Template:Testberg is the name and <includeonly>...</includeonly> is the content. 2. The content of the call to the template, e.g. {{Testberg|name=Berlin}}.

Abrape (talkcontribs)

{{Infobox Test |NAME=Testberg |BILD= |BILDBESCHREIBUNG= |HÖHE=708 |HÖHE-BEZUG=DE-NHN |LAGE=[[Bayern]], [[Deutschland]] |GEBIRGE=[[Fichtelgebirge]] |BREITENGRAD=49/56/49/N |LÄNGENGRAD=12/08/10/E |REGION-ISO=DE-BY |TYP= |GESTEIN=Basalt |ALTER= |ERSTBESTEIGUNG= |BESONDERHEITEN= }}

Tjbrace (talkcontribs)

I just upgraded an instance from 1.35.2 to 1.38.2 (new install, database dump/restore). Most everything is working fine, except on Special:Preferences, none of the tabs are clickable.

I don't see any console errors, and nothing in the debug. I also tried adding #mw-prefsection-editing to the url, but it does nothing.

MediaWiki 1.38.2

PHP 7.4.30 (fpm-fcgi)

MariaDB 10.6.8-MariaDB

ICU 67.1

Lua 5.1.5

Tjbrace (talkcontribs)

Seems that the issue was due to debugging being enabled.

Reply to "Special:Preferences Tabs"

How can I collapse all headers?

3
DStallTX (talkcontribs)

How can I make all headers collapse on page load and expand with down arrow in MediaWiki 1.38?

I found this article - Create Collapsible Content By Heading - jqHeaderSlider and example which is what I want.

How can I get example scripts to work?

I've downloaded them and copied them to my Common.js file but they don't work.

Do I have them in the right order? Or what am I doing wrong or not doing?

Tory John (talkcontribs)

I believe during page load the last option to collapse sections is to look for.

DStallTX (talkcontribs)

And how is that supposed to help me fix this issue?

Did you look at my JS code?

Is there anything wrong with it????

Reply to "How can I collapse all headers?"

Various Error with LDAP modules

6
Summary last edited by Jl-mws 15:04, 9 August 2022 2 days ago

Mostly weird invalid synthax you should guess on your own.

LDAP stack should be more tolerant to syntax, because it will generate a lot of avoidable bugs.

Jl-mws (talkcontribs)

Try and errors

When I try to authenticate as

an LDAP User , I got this error : [ec6935bb5d6a9b7d0d944cdd] 2022-08-05 13:21:20: Erreur fatale de type « MWException »

a Local User : I got this error : Could not authenticate

All the /LDAPProvider/maintenance/ scripts works fine ie : CheckConnection.php CheckLogin.php ConvertLdapAuthenticationConfig.php ShowUserGroups.php ShowUserInfo.php

Versions

MediaWiki 1.35.4
PHP 7.4.30 (apache2handler)
MariaDB 10.5.15-MariaDB-0+deb11u1
ICU 67.1

LDAPAuthentication 2 1.0.3 (6bc5848) 22 juillet 2022 à 10:15
LDAPAuthorization 1.1.0 (a0d1a5b) 4 juillet 2022 à 07:18
LDAPProvider 1.0.5 (80f8cc8) 22 juillet 2022 à 11:29
PluggableAuth 5.7 (a932c78) 23 mai 2022 à 21:17

Configs

  • ldapprovider-aaa.json
{
        "example.com": {
                "connection": {
                        "server": "ad.example.com",
                        "port": "636",
                        "enctype": "ssl",
                        "user": "cn=ldap-connect,cn=Users,dc=example,dc=com",
                        "pass": "********",
                        "options": {
                                "LDAP_OPT_DEREF": 1
                        },
                        "basedn": "cn=Users,dc=example,dc=com",
                        "groupbasedn": "cn=Users,dc=example,dc=com",
                        "userbasedn": "cn=Users,dc=example,dc=com",
                        "searchattribute": "sAMAccountName",
                        "searchstring": "cn=USER-NAME,cn=Users,dc=example,dc=com",
                        "usernameattribute": "sAMAccountName",
                        "realnameattribute": "displayName",
                        "emailattribute": "mail",
                        "grouprequest": "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory"
                },
                "authorization": {
                        "rules": {
                                "groups": {
                                       "required": [ "CN=wikiaaa,CN=Users,dc=example,dc=com" ]

                                }
                        }
                }
        }
}
  • LocalSettings.php
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
        exit;
}
$wgSitename      = "Wiki aaa";
$wgScriptPath       = "";
$wgScriptExtension  = ".php";
$wgServer           = "https://wikiaaa.example.com";
$wgStylePath        = "$wgScriptPath/skins";
$wgLogo             = "$wgStylePath/common/images/logo_aaa.png";
$wgGroupPermissions['*']['createaccount']   = false;
$wgGroupPermissions['user']['createaccount']   = true;
$wgGroupPermissions['wikiaaa']['createaccount']   = true;
$wgGroupPermissions['*']['read']            = false;
$wgGroupPermissions['*']['edit']            = false;
$wgGroupPermissions['sysop']['edit']            = true;
$wgGroupPermissions['user']['edit']            = true;
$wgGroupPermissions['aaa']['edit']            = true;
$wgEnableEmail      = false;
$wgEnableUserEmail  = true; # UPO
$wgEmergencyContact = "apache@wikiaaa.example.com";
$wgPasswordSender   = "apache@wikiaaa.example.com";
$wgEnotifUserTalk      = false; # UPO
$wgEnotifWatchlist     = false; # UPO
$wgEmailAuthentication = true;
$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "wikiaaa";
$wgDBuser           = "userwikiaaa";
$wgDBpassword       = "**********";
$wgDBprefix         = "";
$wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=utf8";
$wgDBmysql5 = false;
$wgMainCacheType    = CACHE_NONE;
$wgMemCachedServers = array();
$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'pdf', 'dmg', 'ppd', 'zip', 'doc', 'docx');
$wgUseInstantCommons  = false;
$wgShellLocale = "fr_FR.utf8";
$wgLanguageCode = "fr";
$wgSecretKey = "6gyo8sj9a2d20vsdh7t51r080s0kqk5tdlx08zxolbxrtui8e7frd0hkxv7xoki825n756";
$wgUpgradeKey = "jbkvvpd7nr";
$wgDefaultSkin = "vector";
wfLoadSkin( 'Vector' );
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl  = "";
$wgRightsText = "";
$wgRightsIcon = "";
$wgDiff3 = "/usr/bin/diff3";
if (is_file("/etc/mediawiki-extensions/extensions.php")) {
        include("/etc/mediawiki-extensions/extensions.php");
}
$wgResourceLoaderMaxQueryLength = -1;
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'AccessControl' );
wfLoadExtension( 'Math' );
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'LabeledSectionTransclusion' );
wfLoadExtension( 'LDAPAuthorization' );
wfLoadExtension( 'LDAPAuthentication2' );
wfLoadExtension( 'PluggableAuth' );
wfLoadExtension( 'LDAPProvider' );
$LDAPAuthentication2AllowLocalLogin = true;
$LDAPAuthentication2UsernameNormalizer = true;
$LDAPProviderDomainConfigs = "/etc/mediawiki/ldapprovider-aaa.json";
$wgDebugLogGroups['PluggableAuth'] = "/var/log/mediawiki/debug-{$wgDBname}.log";
$wgDebugLogGroups['MediaWiki\\Extension\\LDAPProvider\\Client'] = "/var/log/mediawiki/debug-{$wgDBname}.log";
$wgDebugLogGroups['LDAPAuthentication2'] =  "/var/log/mediawiki/debug-{$wgDBname}.log";
$wgDebugLogGroups['LDAPAuthorization'] = "/var/log/mediawiki/debug-{$wgDBname}.log";
$wgDebugLogGroups['LDAPProvider'] = "/var/log/mediawiki/debug-{$wgDBname}.log";
wfLoadExtension( 'Cite' );
wfLoadExtension( 'Mpdf' );
$wgMpdfTab = true;
$wgMpdfToolboxLink = true;

Logs

#Local user

2022-08-05 13:43:13 wikiaaa.example.com wikiaaa: In execute()
2022-08-05 13:43:13 wikiaaa.example.com wikiaaa: Getting PluggableAuth singleton
2022-08-05 13:43:13 wikiaaa.example.com wikiaaa: Class name: MediaWiki\Extension\LDAPAuthentication2\PluggableAuth
2022-08-05 13:43:13 wikiaaa.example.com wikiaaa: Authentication failure.
2022-08-05 13:43:13 wikiaaa.example.com wikiaaa: ERROR: Could not authenticate

# LDAP user
2022-08-05 13:45:34 wikiaaa.example.com wikiaaa: In execute()
2022-08-05 13:45:34 wikiaaa.example.com wikiaaa: Getting PluggableAuth singleton
2022-08-05 13:45:34 wikiaaa.example.com wikiaaa: Class name: MediaWiki\Extension\LDAPAuthentication2\PluggableAuth
2022-08-05 13:45:35 wikiaaa.example.com wikiaaa: Setting LDAP_OPT_PROTOCOL_VERSION to 3
2022-08-05 13:45:35 wikiaaa.example.com wikiaaa: Setting LDAP_OPT_REFERRALS to 0
2022-08-05 13:45:35 wikiaaa.example.com wikiaaa: Setting LDAP_OPT_DEREF to 1
2022-08-05 13:45:35 wikiaaa.example.com wikiaaa: MediaWiki\Extension\LDAPProvider\Client::getSearchString: User DN is: 'cn=user1,cn=Users,dc=example,dc=com'
2022-08-05 13:45:35 wikiaaa.example.com wikiaaa: Ran LDAP search for '(sAMAccountName=user1)' in 0,0016958713531494 seconds.
Bawolff (talkcontribs)

please set $wgShowExceptionDetails=true;

Jl-mws (talkcontribs)

For an LDAP User, I got

[7dfc41e030b5d57f84ec0e88] /index.php/Sp%C3%A9cial:PluggableAuthLogin MWException from line 89 of /var/lib/mediawiki/extensions/LDAPAuthentication2/src/PluggableAuth.php: The UsernameNormalizer for LDAPAuthentiation2 should be callable

Backtrace:

#0 /var/lib/mediawiki/extensions/LDAPAuthentication2/src/PluggableAuth.php(60): MediaWiki\Extension\LDAPAuthentication2\PluggableAuth->normalizeUsername()
#1 /var/lib/mediawiki/extensions/PluggableAuth/includes/PluggableAuthLogin.php(36): MediaWiki\Extension\LDAPAuthentication2\PluggableAuth->authenticate()
#2 /usr/share/mediawiki/includes/specialpage/SpecialPage.php(600): PluggableAuthLogin->execute()
#3 /usr/share/mediawiki/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run()
#4 /usr/share/mediawiki/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#5 /usr/share/mediawiki/includes/MediaWiki.php(945): MediaWiki->performRequest()
#6 /usr/share/mediawiki/includes/MediaWiki.php(548): MediaWiki->main()
#7 /usr/share/mediawiki/index.php(53): MediaWiki->run()
#8 /usr/share/mediawiki/index.php(46): wfIndexMain()
#9 {main}

It works, with errors, for a local account

Malyacko (talkcontribs)

@Jl-mws If you still run MediaWiki 1.35.4 then you run an outdated insecure software version. Please update to a supported version for your own safety.

Jl-mws (talkcontribs)
Jl-mws (talkcontribs)

Several points, for your information:

In the ldapprovider.json :

  • the attributes requires lowercase despite their regular name ie 'displayName' for example

so ldapprovider.json (extract) become :

                        "usernameattribute": "samaccountname",
                        "realnameattribute": "displayname",
                        "emailattribute": "mail",
                        "grouprequest": "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory",
                        "presearchusernamemodifiers": [ "spacestounderscores", "lowercase" ]

  • the require.group require the "Full DN name" ie "CN=wikiaaa,CN=Users,dc=example,dc=com" even if short name are show and revolved by LDAPProvider/maintenance/ShowUserGroups.php

I was using the short name for configuration clarity, it doesn't work

After upgrade to 1.38 website is showing only blank white page

9
Vikasnd (talkcontribs)

I upgraded from 1.35.7 to 1.38, ran the update script for database.

Then ran the website. on front page it showed 'deprecated...' message for 3-4 extensions and showed blank page. So I disabled the related extensions. Then again browsed the site. This time then I started gettign white blank page with no content at all. I looked at error log, it had nothing.

I changed the directory back to 1.37 for now. Please suggest what I should be looking and fixing.

Thanks Vikas

Jonathan3 (talkcontribs)

Maybe remove or upgrade all extensions.

Jonathan3 (talkcontribs)

Maybe check LocalSettings.php for errors introduced when you got rid of the extensions.

Vikasnd (talkcontribs)

Diff'ed the file and checked it, but nothing is different than comment mark on few extensions.

Bawolff (talkcontribs)

Verify you have errors turned on in php.ini (see How to debug)

Vikasnd (talkcontribs)

I have this turned on already.

Malyacko (talkcontribs)
Vikasnd (talkcontribs)

This did not help. There was still blank page.


So I took off all extensions, still it was blank page.


Then lastly I took off the 'foreground' skin that was being used. Then it started showing the page. I upgraded the skin, it looked better. Still figuring out other things, but this is how it was resolved. But there were no logs created to note whatever issue it was having. Would have helped a lot if there was some log written..


Thanks to all of you.

Jonathan3 (talkcontribs)

Good stuff. I like foreground but seem to have had some sort of problem with it during the last few MW upgrades. I'm pleasantly surprised it works on 1.38 :-)

Upload Files Error: Could not open lock file for "mwstore://local-backend/local-public/..."

2
멍한오리 (talkcontribs)

Hello, I run MediaWiki using Ubuntu 20.04 and XAMPP.

In order to solve this upload problem, I set the owner of the "Images" directory to www-date and set the permission to 755, but the problem has not been solved.

I can't solve this problem anymore because I'm a beginner of web server operation. If there is any information related to this, please let me know.

Thank you.

Bawolff (talkcontribs)

For starters its www-data not www-date.

XAMPP is a bit of an odd choice if using ubuntu. Normally you would use ubuntu's builtin package manager (e.g. apt).

If using xampp, apache may be running as a different user and not www-data, so its possible that that is not the correct owner for the files.

Reply to "Upload Files Error: Could not open lock file for "mwstore://local-backend/local-public/...""