Project:Support desk

Jump to navigation Jump to search

About this board

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

(Read this message in a different language)

See also

Other places to ask for help:

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".

How do I get and backup a list of installed extensions as part of my regular backup?

1
Anbh42 (talkcontribs)

I have neglected to keep a list of which extensions are installed on my mediawiki instance. I run it on Apache on my host and have configured my backups with an old tool called backup-manager, where I specify which databases to backup from my db instance, and which directories on my file system.


Can I backup my extensions directory and then just restore it simply into the right place when doing a restore, in order to re-install all my extensions?


Thanks

Reply to "How do I get and backup a list of installed extensions as part of my regular backup?"

How to set auto email to new users that were created by admin?

2
Aman16777 (talkcontribs)

As admin if I were to create a new user, is it possible to set auto mail to the new user?

The content of the mail is to basically welcome the new user and provide them with their account username and password.

The flow:

Super admin creates a new user > User receives mail based on the email address entered by super admin> User checks mail > The mail content contains username & password for the user to log into the system.

Aman16777 (talkcontribs)

Could anyone please help me resolve this issue?

Reply to "How to set auto email to new users that were created by admin?"

Images only appear when folder permissions set to 777

3
AesopHimself (talkcontribs)

Images upload just fine and everything appears, but only when set to 777.

If I set it to 774, nothing.


Obviously I don't want to keep it at 777, but it seems to be the only thing that works to show them.

Changing the owner to www-data works, but it still has to be at 777 or else the thumbnail breaks and accessing the image throws Forbidden.


Any ideas?

Jonathan3 (talkcontribs)
Ciencia Al Poder (talkcontribs)

Directories must be executable, otherwise they can't be accessed. Either use bits to 7 or 5 but not 4 unless you explicitly want users to not access them

Reply to "Images only appear when folder permissions set to 777"

How to run custom PHP over MediaWiki

23
182.232.50.87 (talkcontribs)

I have created a PHP file which loads an HTML-frontend custom-developed "call now" position:absolute "sticky" button module.

I want to run that PHP file every time a MediaWiki page is loaded, so that this custom developed module would be loaded for each MediaWiki page and thus available to any user on any webpage in my website.


How can this be done?

Jonathan3 (talkcontribs)

If you really need to add PHP to each page you could edit the skin - /skins/Vector/includes/VectorTemplate.php maybe?

If you just need to add a button to each page maybe you could use MediaWiki:Sitenotice (see Manual:Interface/Sitenotice). If the button has HTML/Javascript that can't usually go on a wiki page you could try Extension:Widgets or similar.

182.232.50.87 (talkcontribs)

@Jonathan3

I have actually created two PHP modules, one is a contact form and one is a the "call now".

I can access the contact form by example.com/contact_form/contact_form.php but in contrast, example.com/call_now/call_now.php is of course something which is not a standalone webpage, rather just a caller for some HTML-CSS.


I can understand why you recommend to edit a skin's main PHP file; in theory I could paste all the PHP code currently in call_now.php inside the skin's main PHP file but the problem with that is that it each time I would upgrade MediaWiki I would have to re-paste it there again.


I think that what I need is to to execute my code from within MediaWiki GUI somehow (just as I paste JavaScript in Common.js and CSS in Common.css).

Jonathan3 (talkcontribs)

Could you not just add an include line to the skin?

Jonathan3 (talkcontribs)

What is the HTML/CSS in the "call now" button?

182.232.50.87 (talkcontribs)

@Jonathan3 sure I could but I aspire to untouch the skin's PHP (Maybe I should add such in include in LocalSettings.PHP?).

The HTML for basic functionality is:

main_box.php

<!DOCTYPE html>
<html>
	<head>
		<?php
			include './assets/assets.php';
		?>
	</head>
	<body>
		<div dir="rtl" class="cacb_main_box">
			<?php
				include './phone_box.php';
				include './email_box.php';
			?>
		</div>
	</body>
</html>

phone_box.php

<!DOCTYPE html>
<html>
	<head>
		<?php
			include './assets/assets.php';
		?>
	</head>
	<body>
        <div class="cacb_phone_box">
            <a class="cacb_phone_link" href="tel:URI">
                <img class="cacb_phone_icon" src="./images/VECTOR.svg"></img>
                <span class="cacb_phone_text">Call now</span>
            </a>
        </div>
	</body>
</html>
Bawolff (talkcontribs)
182.232.50.87 (talkcontribs)

@Jonathan3 sadly, uploading the directory of the module to my website application root (and then using include './MODULE'; in LocalSettings.php, didn't help.

182.232.50.87 (talkcontribs)

include './MODULE/main_box.php';

*

The " index.php " if you will, of the module.

Jonathan3 (talkcontribs)

Does anything work where you put that line, eg echo "hello"; ?

Maybe double check the path.

Jonathan3 (talkcontribs)

I've just looked on the computer and see your code. Maybe the "./" parts of the paths (for current directory) don't work when the file is included from a file in another directory, so should be changed.

Jonathan3 (talkcontribs)

"Maybe I should add such in include in LocalSettings.PHP?"

You could try it. If you "echo" some text in the middle of that file, it'll get printed at the very top of the page, completely separately from the MediaWiki page (if that makes sense). So maybe you could add your buttons there.

Or if you find a suitable hook you could maybe add some code to LocalSettings.php, sort of like a mini-extension without needing to write an extension.

182.232.50.87 (talkcontribs)

@Jonathan3 the code works for me in a web browser with the ./ parts

The full code is available here:

codereview.stackexchange.com/questions/268069/php-processed-html-css-cms-agnostic-contact-now-panel


A hook might be the way to go, but I feel quite lost in Manual:Hooks. Should I create a JSON command? What, ideally should such JSON command do?... What should be the condition for the reaction of executing my code?

182.232.50.87 (talkcontribs)

In JavaScript that condition might be:

window.addEventListener('load', () => {
});

But in PHP I don't know.

Jonathan3 (talkcontribs)

"the code works for me in a web browser with the ./ parts"

Does it work in your web browser when included from a php file in a different directory?

182.232.50.87 (talkcontribs)

Sadly, no.

Jonathan3 (talkcontribs)

All right then, maybe change the paths and see if that helps. Get it to work like this, then it might also work within the skin.

182.232.50.87 (talkcontribs)

The paths are in order; I prefer not to use it in the skin at all.

For possible future readers: In the end I would take the HTML-CSS only path (without using PHP format which helps me to well organize the code, in that case), as I have explained below.

Jonathan3 (talkcontribs)

There are lots of simple ways to achieve what you want. Unfortunately I'm not expert enough to do it the way you want :-)

182.232.50.87 (talkcontribs)

You mean in PHP?

Jonathan3 (talkcontribs)

"If you just need to add a button to each page maybe you could use MediaWiki:Sitenotice (see Manual:Interface/Sitenotice). If the button has HTML/Javascript that can't usually go on a wiki page you could try Extension:Widgets or similar."

What you're adding isn't really PHP (though I don't know what's in assets.php).

182.232.50.87 (talkcontribs)

I think that because this is a pure front-end module, I should not be using PHP includes in that particular case and just use a large HTML file; I don't want to take that path because the includes help me a lot, but I doubt I have a chance.

Jonathan3 (talkcontribs)

It makes sense now - "I format it in PHP because PHP supports include which I use a lot to well organize the code."

Yes I would just forget about using PHP at all. Try to get it working in wikitext. They're only buttons/links after all.

This might be an example of the XY problem!

Reply to "How to run custom PHP over MediaWiki"

Manuel Guide to Create php.ini file

4
Thatnewman (talkcontribs)

Hello Everyone I am Trying to install Extension:Scribunto and I got stuck at here

This extension runs on top of an executable. You must have permission to run executables on your host in order for this extension to work.


So I contacted them and they gave me the link to enable it.. But the settings is in the php.ini File which is : To enable exec() function, you need to remove it from the following line in your php.ini file:

disable_functions = "show_source, system, shell_exec, exec"


And I later found out I don't have php.ini file.. They already told me how to create new one.. But the problem is The file is Empty. Where do I get the configurations or where can I download an already made Php.ini....

Secondly ;-I am on shared hosting and my current Php version is 7.4 .. Should i upgrade to version 8.0???????????

Jonathan3 (talkcontribs)

I can only answer the last question... don't upgrade to PHP 8 yet - see Compatibility#PHP.

With the other stuff... maybe try out a cheap unmanaged VPS - I'm on Digital Ocean now and things "just work" (like Scribunto) including things that I had difficulty with for years on a shared server.

Thatnewman (talkcontribs)

I should Host on another server? okay will do thanks.

Jonathan3 (talkcontribs)

I don't know whether you should or not :-) Can't do any harm. It'll only cost $5 or whatever to find out.

Reply to "Manuel Guide to Create php.ini file"

WikiFamily creation user problems

5
Summary by Fokebox

The problem resolved by adding this two lines of code:

$wgSharedTables[] = 'user';
$wgSharedTables[] = 'actor';
Fokebox (talkcontribs)

Hello dear Team.

I have a wikifamuly made just like wikipedia. I set up wiki with different localisations: ru.wikijournal - Russian wiki, en.wikijournal.org - english wiki etc.

After upgrading wiki to 1.35. I noticed that there is problems with user account creation. I mean that if you are creating user at ru.wikijournal.org, it does not create account in other localisations and vice versa creating for example at en.wikijournal.org it does not create account in other localisations. I have following set upo at Localsettings.php:

# MySQL specific settings
$wgDBprefix = "ru__";

# Single Sign On (one entry point for all wikis)
$wgSharedDB = "wikijournal_org"; 
$wgSharedPrefix = "ru__"; 
$wgCookieDomain = '.wikijournal.org';

# Shared tables
$wgSharedTables[] = 'interwiki';
$wgSharedTables[] = 'ipblocks';
$wgSharedTables[] = 'user_groups';

So, previously at wiki 1.30. all worked fine, but after upgrading something happened and I have creation user problems described above. Could someone help me to resolve the issue? What can I try?

Fokebox (talkcontribs)

The problem remains. What is interesting all users registered before upgrade can log in without problems, but new registered users can log in at localisation where they are registered. I believe the problem with $wgSharedTables[] = 'user_groups'; Anyway I appreciate if you help me to resolve the problem.

Bawolff (talkcontribs)

Maybe actor and user table has to be shared too (total guess. I dont know)

Fokebox (talkcontribs)

Added

$wgSharedTables[] = 'user';
$wgSharedTables[] = 'actor';

And resolved a problem

Fokebox (talkcontribs)

What do you mean by “actor and user table”. And how shall I fo it?

like this? $wgSharedTables[] = 'actor';

Pooja2425 (talkcontribs)

Hi,

<pdf width="780" height="560">Flow_charts.pdf</pdf>

Please suggest me which extension i have to use to work if we include pdf in this type. Its working in Version 1.31 . But not working in v 1.35.3.

Osnard (talkcontribs)
Pooja2425 (talkcontribs)

HI ,

Product Version
MediaWiki 1.35.3
PHP 7.4.23 (apache2handler)
MySQL 8.0.26
Lua 5.1.5
Elasticsearch

when using PDFEmbed giving error " Call to undefined method Parser::disableCache() ", error given below.

<pdf height=800 width=800>CARBONATE_SEISMIC_CHECKLIST.pdf</pdf>

<embed>CARBONATE_SEISMIC_CHECKLIST.pdf</embed>


same file coming with simple embed extension, but not from <pdf> tag.

since we are using <pdf></pdf> tag into 1000+ pages. we cannot change manually.

pls suggest any supporting extension to support <pdf></pdf> tag.


or give working extenison PDFEmbed.

[YUNWMeVcOnGQwRm0xefEugAAAAI] /wiki/index.php/Discipline/Prospect_evaluation Error from line 39 of /data/www/html/wiki/extensions/PDFEmbed/PDFEmbed.hooks.php: Call to undefined method Parser::disableCache()

Backtrace:

#0 /data/www/html/wiki/includes/parser/Parser.php(3922): PDFEmbed::generateTag()

#1 /data/www/html/wiki/includes/parser/PPFrame_Hash.php(330): Parser->extensionSubstitution()

#2 /data/www/html/wiki/includes/parser/Parser.php(2887): PPFrame_Hash->expand()

#3 /data/www/html/wiki/includes/parser/Parser.php(1556): Parser->replaceVariables()

#4 /data/www/html/wiki/includes/parser/Parser.php(651): Parser->internalParse()

#5 /data/www/html/wiki/includes/content/WikitextContent.php(374): Parser->parse()

#6 /data/www/html/wiki/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput()

#7 /data/www/html/wiki/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput()

#8 /data/www/html/wiki/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()

#9 /data/www/html/wiki/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()

#10 /data/www/html/wiki/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()

#11 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()

#12 /data/www/html/wiki/includes/Revision/RenderedRevision.php(197): call_user_func()

#13 /data/www/html/wiki/includes/poolcounter/PoolWorkArticleView.php(216): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()

#14 /data/www/html/wiki/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()

#15 /data/www/html/wiki/includes/page/Article.php(810): PoolCounterWork->execute()

#16 /data/www/html/wiki/includes/actions/ViewAction.php(74): Article->view()

#17 /data/www/html/wiki/includes/MediaWiki.php(527): ViewAction->show()

#18 /data/www/html/wiki/includes/MediaWiki.php(313): MediaWiki->performAction()

#19 /data/www/html/wiki/includes/MediaWiki.php(940): MediaWiki->performRequest()

#20 /data/www/html/wiki/includes/MediaWiki.php(543): MediaWiki->main()

#21 /data/www/html/wiki/index.php(53): MediaWiki->run()

#22 /data/www/html/wiki/index.php(46): wfIndexMain()

#23 {main}

Osnard (talkcontribs)
Reply to "Pdf issue"
SeveerGamr092 (talkcontribs)

how do i recieve my rewards for my referrals. i havent heard anything and i have also had people use my referrals that i didnt get credit for.

Jonathan3 (talkcontribs)

"Your reward will be in Heaven." I bet you ended up here by clicking the "Help" link on a website running MediaWiki. This is just for the software behind the website.

Reply to "referrals"

How can i create all these stuff on my wiki

5
Thatnewman (talkcontribs)
Jonathan3 (talkcontribs)
Thatnewman (talkcontribs)

I am trying to upload them on my wiki... and I got this Import failed: No interwiki prefix was supplied. what should I do or how do I upload them.

which one of them

Import to default locations

Import to a namespace:

and will I mark

Assign edits to local users where the named user exists locally

And the Interwiki prefix:

will it be Emypt

Thatnewman (talkcontribs)
Jonathan3 (talkcontribs)

Probably stacks of that will be written specially for Wikipedia

You might be better just reading it for inspiration and writing your own stuff

Reply to "How can i create all these stuff on my wiki"

Need some help with upgrading mediawiki

14
Pritesh j thakkar (talkcontribs)

We are currently running following version, plan is to move mediawiki to CentOS 7 and upgrade mediawiki. Can you please guide me which version I should upgrade to first before latest LTS version ? and how can i upgrade it ?

Product Version
MediaWiki 1.15.4
PHP 5.3.3 (apache2handler)
MySQL 5.1.73

Thanks,

Fokebox (talkcontribs)

First of all try to follow official guidance on upgrading. If you face any difficulties, drop a message here.

P.S. I believe you will have some difficulties as you MW version extremely old, so probably you should ugrade step by step to newer version like from 1.15. to 1.20 to 1.25 to 1.30. etc.

Pritesh j thakkar (talkcontribs)

@Jonathan3 @Fokebox

Can you please have a look at following approach and tell me if I should be doing it differently ?

- I have built new centos 7 server and installed following packages :

httpd php php-mysql php-gd mariadb-server php-xml php-intl mysql

- export db from old server, and import it on new server, bring mediawiki code (/var/www/wiki) and save it on new server

- After 1.15 next LTS version is 1.19 so download that code. Backup existing mediawiki dir, untar new mediawiki release, copy LocalSettings.php from backup and test

Is there any document I can follow for step upgrade ?

Jonathan3 (talkcontribs)
Jonathan3 (talkcontribs)

Yes, there's a new note on that page saying: "Since Version 1.36, MediaWiki only commits to supporting upgrades from two LTS releases ago (see phab:T259771). Upgrades from older versions of MediaWiki will have to be performed in multiple steps. This means that if you want to upgrade to 1.36 from 1.23 or earlier, you'll first have to upgrade your 1.23 wiki to 1.27 (or 1.35), and, from 1.27 (or 1.35), you'll be able to upgrade to 1.36."

Jonathan3 (talkcontribs)

Looking at it again, to me this sentence is nonsense (i.e. I can't make sense of it!)

[Edit, since indentation didn't work as I had expected: I mean the sentence beginning "Since Version 1.36, MediaWiki only commits to supporting upgrades from two LTS releases ago..."]

Looking at task T259771, it says: "Also, everything up to 1.35 can still be done in one step. So someone who, in four years, wants to upgrade from 1.29 to 1.43, will have to do two steps: one to 1.35, and one to 1.43. To upgrade to 1.50 in seven years, you'd go from 1.29 to 1.35 (2020), then to 1.43 (2024), and finally to 1.50 (2027). Not too terrible, I think."

So it looks like you could go straight from 1.15 to 1.35. You couldn't go from 1.15 to 1.36 though. You might as well go straight to 1.35, then 1.36, as then you don't have to mess around with different PHP versions etc.

This post was hidden by Pritesh j thakkar (history)
Jonathan3 (talkcontribs)

Maybe that's a php version thing. You don't need to move the old wiki php files across. Just the database plus a selection of files (localsettings.php etc). You download the new mediawiki files from the tarball, then copy across those selected files.

Pritesh j thakkar (talkcontribs)

@Jonathan3 @FokeboxI just tried to upgrade to mediawiki-1.35.3.tar.gz, but now home page isn't displaying (blank page). And php update.php, is not showing any output and exit code is 255.

I have upgraded php to PHP 7.4.23, can you please advise how I can fix that ?


Thanks,

Jonathan3 (talkcontribs)

I'm only another user. But what exactly have you done (ie every step)?

Pritesh j thakkar (talkcontribs)

I have documented steps as I was upgrading it :


tar -xvzf ~pritha1/mediawiki-1.35.3.tar.gz

mv mediawiki-1.35.3/ wiki

cp -ip wiki_WORKING/LocalSettings.php wiki

cp -prv ../wiki_WORKING/images .

php update.php

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/wiki/maintenance/update.php on line 131

php --version

PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

After upgrading

[root@psapql427 yum.repos.d]# php --version

PHP 7.4.23 (cli) (built: Aug 24 2021 16:33:30) ( NTS )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

[root@psapql427 maintenance]# php update.php

Error: Missing one or more required components of PHP.

You are missing a required extension to PHP that MediaWiki needs.

Please install:

* mbstring <https://www.php.net/mbstring>

yum install php74-php-mbstring.x86_64

php update.php

echo $?

255

I really appreciate for helping me with it.

Thanks,

Jonathan3 (talkcontribs)

This is a wild guess, but maybe the update script did some stuff during the first two attempts, and its half-done job is now causing problems.

Until you hear form someone else, what about just starting from scratch (i.e. copy across your database, new MW 1.35 files, and LocalSettings and images, then run update.php)?

Or what about commenting out all the extension lines in LocalSettings.php? That changed from "include" to "wfLoadExtension".

Or what about installing a brand new MW1.35 purely to obtain a new LocalSettings.php file? Then using that to recreate one for your actual wiki. Maybe something important has changed. I think a few old lines I had left over from MW1.5 or so caused me trouble recently.

Pritesh j thakkar (talkcontribs)

I have uninstalled PHP7.4 and refreshed db again and mediawiki 1.15 is working again.

"new MW 1.35 files, and LocalSettings and images, then run update.php)? " do I need to upgrade Php before doing that ?

php --version

PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)

Jonathan3 (talkcontribs)

Yeah the MW1.35 files on the new server will need the new version of php etc.

Don't forget to follow the instructions rather than just my message :-)

Reply to "Need some help with upgrading mediawiki"