Setting Up Infobox Templates in MediaWiki v1.23


Update 2021-02-23: A few people have left comments saying these instructions no longer work. Unfortunately I’m not surprised – they’re quite old and MediaWiki has evolved significantly. They still work in my ancient version which I still have on an old Debian box.

I am planning on migrating this onto a new server soon so I will be revisiting this soon*.

*May not be soon


This article explains how to add the “Infobox” template to your MediaWiki installation. It is primarily intended for people who have installed v1.23 from source.

This is an updated version of this older post about setting up Infobox on earlier versions of MediaWiki. It is basically the same but has been modified to be suitable for the current (at the time of writing) version of MediaWiki, v1.23. Please see the older post for more info and background as well as helpful commentary from other users in different circumstances.

Here are the basic steps necessary to add working Infoboxes to a freshly installed version of MediaWiki. Note that the original steps required the install of ParserFunctions; this is no longer required as it ships with recent versions of MediaWiki by default.

  1. Download the Scribuntu extension into your extensions folder and add it to your LocalSettings.php as described in the ‘Installation’ section.
  2. Copy the CSS required to support the infobox from Wikipedia.org to your Wiki. The CSS is available in Common.css. You’ll probably need to create the stylesheet – it will be at http://your_wiki/wiki/index.php?title=MediaWiki:Common.css&action=edit – and then you can just copy/paste the contents in there. (I copied the whole file; you can probably just copy the infobox parts.)
  3. Export the Infobox Template from the Wikipedia.org:
    1. Go to Wikipedia’s Special:Export page
    2. Leave the field for ‘Add pages from category’ empty
    3. In the big text area field, just put in “Template:Infobox”.
    4. Make sure the three options – “Include only the current revision, not the full history”, “Include templates”, and “Save as file” – are all checked
    5. Hit the ‘Export’ button; it will think for a second then spit out an XML file containing all the Wikipedia Templates for the infobox for you to save to your PC.
  4. Now you have the Template, you need to integrate them into your MediaWiki instance. Simply go to your Import page – http://your_wiki/wiki/index.php/Special:Import – select the file and then hit ‘Upload file’.
  5. With the Templates and styles added you should be able to now add a simple infobox. Pick a page and add something like this to the top:{{Infobox
    |title = An amazing Infobox
    |header1 = It works!
    |label2 = Configured by
    |data2 = trog
    |label3 = Web
    |data3 = [https://trog.qgl.org trog.qgl.org]
    }}
  6. Save, and you should end up with something that looks like this:

40 thoughts on “Setting Up Infobox Templates in MediaWiki v1.23”

  1. When I do all of the above, I get a script error when I try to use the Infobox.

    It says “Script Error: No such module “Infobox”.

  2. I missed that part, and I feel dumb. However, now that I’ve fixed it, I got this error when importing into my wiki:

    Import failed: The lua binary (/etc/w/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable.

    I fixed the permissions on the file, but now when I run the import I just get a blank white screen.

    I appreciate your help.

  3. Travis,

    I found debugging weird issues basically impossible and whenever I ran into something like that I would just re-install the Wiki from scratch. Is that an option?

  4. Hey trog,

    for a long time you have been the only sane voice burried in mediawikis horrid documentation. Thank you for that.

  5. omg it actually worked. Took all day, but I finally got it thanks to this tutorial. Thank you! :)

  6. I’m having the exact same problem as Travis described. Although I did not forget to tick the boxes on the export page. Aside from that I am having the exact same issues. Same lua error and my infobox person template does not exist, as it shows up in red when I try to create a box on a Wiki page I am trying to create. When the red infobox text is clicked, I get the ““Script Error: No such module “Infobox”

    Are you saying installing the entire Wiki again from scratch will resolve this, or is there a common issue some of us are running into that can be fixed easier?

  7. Ah I see you’ve commented there as well. I’ll have a crack at it ASAP and see if I can figure out what is going on.

  8. Just ran through the process with an entirely new install and it worked fine, although I did run a Lua problem when adding the template code to my page. I got an error of this form:

    PHP Warning: proc_open(/dev/null) [function.proc-open]: failed to open stream: Operation not permitted

    Checking my PHP error log I found:

    PHP Warning: proc_open() [function.proc-open]: open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): […]

    I forgot that my site has some weird open_basedir restrictions as part of some random security experiments I was doing. I simply removed them, re-saved the template page, and it started working fine.

  9. At this point, I am to the point where the XML upload seemed to work finally. When I try the infobox example code you provided in the walkthrough, I get this:

    “Lua error: Internal error: Error reading from pipe.”

    Not sure how pertinent this is, but I’m not sure I was able to chmod the lua file to make it executable. I use Dreamhost hosting and my FTP client is FireFTP. FireFTP returns with a 500 error and says ‘chmod’ i snot a recognizable command. So, I went into my WebFTP service directly through Dreamhost and set the entire binaries directory within the Scribunto folder and all it’s contents to executable. That finally seemed to allow the XML file to upload without any issues. Just wanted to pass that along.

  10. I’m just fucking done. This shit is so goddamn retarded. No one has any helpful info. Just a simple breakdown showing how to get a stupid box to show up on the side panel. Problems arise after every walk through. One plausible fix to said issue causes another two hours of secondary problems. Complete waste of time. I’m just gonna screen shot a random Wiki page and shop in the info and paste over the image. Done.

  11. Sorry for the rant. Just ready to scream and punch holes in every wall in my house. I’ve been a website admin for years and have never seen something so senselessly complex and uselessly complicated. I hope Wiki gets on board with WordPress and others soon and enters the new era. I feel like I’m stuck in the 1970’s with this outdated mess. Nothing this simple should be so complicated in 2015. Ugh.

    Apologies, Trog. I’m happy this walkthrough works for you and apparently among others. I have no idea what I’m doing wrong. I just wiped out my entire database out of disgust. Maybe I’ll try to reinstall it and use a different file manager. Maybe that’s where things are getting screwed up.

  12. No worries man, I know what it’s like – actually getting this working in the first place was a hair-tearing experience and I hoped that documenting it would help others reduce stress levels.

    I am at a complete loss to why they decided to use Lua as a scripting engine; it seems to be the source of most of these problems. Without knowing anything about Dreamhost I suspect something about the way it handles the Lua executables might be munging things up.

    One thing I found was that after changes I sometimes had to re-edit the content and re-save it before it would work – I couldn’t just make a config/permission change and refresh and have it work. No idea why but again I suspect something to do with the way the Lua stuff runs internally.

  13. I appreciate your responses and info. Now that I’ve had dinner a few brews I’ve got a clearer mind. I hate giving up on anything. I still need this thing to work out. Perhaps I’ll message Dreamhost and ask them if they can shed any light on the Lua issues. They’ve actually been helpful in the past with other issues. Maybe there’s an internal setting I can adjust to allow it to run more freely or something.

    The one question I have for you, and I think this could be big if ignored, did you actually have to run the chmod command to get the Lua the proper executable permissions, or did it just work by you simply adding the recommended code to your LocalSettings.php file? That was one part where I couldn’t get passed. My FTP client would not allow me to chmod the file. I set permissions other ways, but still had issues.

  14. Ok, here’s a HUGE update! I’m finally making some progress. I said screw it (more harshly worded earlier) and deleted my entire Wiki and started again. Created a brand new directory and installed MediaWiki again. Then, I followed this guide (http://www.mediawiki.org/wiki/Manual:Importing_Wikipedia_infoboxes_tutorial) step by step, doing everything it recommended I do, even added the extra extensions that weren’t required, but recommended (updating the LocalSettings.php file as directed for each extension). I created both the CSS and JS pages it recommends. I granted the entire Scribunto folder and all of it’s contents full write and executable permissions via right clicking it in my FireFTP client. No chmod/chcon commands were used.

    Then I went to Wiki’s export page and searched this:

    Template:Infobox
    Template:Infobox/doc
    Template:Infobox person
    Template:Infobox person/doc

    With all three options checked.

    Went to my own Wiki’s import page and imported the XML file and for the first time since I’ve began doing this the entire file uploaded without one error. All templates I need along with their accompanying docs and modules were included. XML file was about 450KB as opposed to the 230KB file I was getting when using the walkthrough on this page. I think those search credentials pull the extra files I personally needed to get the result I was looking for.

    Ok, so now on to the moment of truth…….

    I attempted an InfoBox using a basic code such as the one outlined in Trog’s walkthrough. Had my fingers crossed, only to get this:

    “Lua error: Internal error: The interpreter exited with status 2”

    Googled it and was taken right back to the Scribunto extension page I had been on earlier. Followed it’s suggestion to increase the memory allocation for Lua by inserting these two lines of code into the LocalSettings.php file:

    $wgScribuntoEngineConf[‘luastandalone’][‘memoryLimit’] = 209715200; # bytes

    $wgMaxShellMemory = 204800; # in KB

    ……..annnnnnnnnnnnnnnnnnnnd SUCCESS!!!!!!!!

    I finally have an InfoBox without one single error and it is styled exactly the way it would appear on the official Wikipedia site.

    Gonna have another brew to celebrate.

    Once again Trog, sorry for that vulgar outburst earlier. I guess I needed that release to get focused again and figure out where I went wrong. Thanks for your walkthrough. Although it didn’t exactly work for me as it has for some others, it did get me very familiar with working with this material and pointed me in the right direction of the process that would ultimately work.

    Anyone else having similar problems should give this solution a shot.

    Hope this Scribunto monster has been tamed……….

  15. I’ve been at this for three days now and am at wit’s end.
    I’ve exported the Infobox pages, checked all three boxes, installed Scribunto, set Scribunto’s permissions on the lua execs to 755, set Scribunto to use 200mb mem in the localsettings file, imported the pages, loaded up a test page and it gives me a “Script Error: Resource temporarily unavailable in ….extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 211”

  16. Oh, and “Warning: proc_open() [function.proc-open]: fork failed – Resource temporarily unavailable in…” on import

  17. Thank you fr the tutorial, but I’ve run into a problem at step 4. I installed Scribunto and added the appropriate lines to my LocalSettings.php file, changed permissions on the executables, etc., then got to step 4 and pressed the “Upload file” button to get this:

    “Fatal error: Call to undefined function pcntl_wifsignaled() in /home/cedrickm/public_html/trapenia/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 645”

    I’m stumped. Has anyone else had this problem? Is there a fix?

    Thanks!

  18. I too have the same issue “Fatal error: Call to undefined function pcntl_wifsignaled() in (…)/LuaStandaloneEngine.php on line 645”

    Haven’t been able to figure this one either.

  19. Hi-

    Thanks for your detailed instructions. Despite what seems like a simple to follow recipe I can’t seem to get my infoboxes to appear. I’m getting this error:

    Lua error: Internal error: The interpreter has terminated with signal “2”.

    I can’t find what the error refers to anywhere.

    It might have something to do with this:

    Set type to httpd_sys_script_exec_t if SELinux is enforced:

    chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/yourOS/lua

    I don’t know linux and I’m not sure how perform this. Per Special:Version, Scribunto is installed. I’ve set the CHMOD to 755 for the correct binary, I believe.

    Not sure what to do next other than scrap the idea of having infoboxes altogether. But if you can help me find a solution, I’d really appreciate it.

    thanks in advance!

  20. Hi Trog. I’m not sure. The site is hosted on Dreamhost. I know it’s not a VPS plan.Sorry, I know that’s not very helpful.

  21. Andrew,

    Yeh mate sorry, not really sure – unfortunately (as you can see from the many comments!) the process looks simple but is actually quite fiddly as it depends on many underlying components being the exact right version.

    I suspect you might be using a Dreamhost shared hosting environment in which case it might be very hard to get up and running without their direct support on the server side. Sorry I can’t be of more help!

  22. Thanks. I understand. Quick question. Could my issue have anything to do with the Scribunto install process, specifically this:

    Set type to httpd_sys_script_exec_t if SELinux is enforced:

    chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/yourOS/lua

    I don’t really know Linux and have no idea how to do that.

  23. I’ve actually never seen that chcon command before so I’m not sure – sorry! It looks like it might be part of SELinux which I’m not very familiar with.

  24. So I seem to be stuck on the uploading templates.

    [WEiAZMC5gBEAACvINYcAAAGA] 2016-12-07 21:34:31: Fatal exception of type “DBUnexpectedError”

    Is the error I receive.

    I have to imagine it’s a error with my Scribunto. I am uploading this to a website and do not have Linux command access.

    Though a “https://my.ehost.com/” I have access to a “Cron Jobs” that seems like it might be able to run a script.

    Like many people here infoboxes seem extremely complicated, for what they are doing.

    Any help would be appreciated.

  25. Patric, if you don’t have shell access I suspect it might be extremely difficult to set up. I haven’t tried setting it up on a box I didn’t have easy access to the core system software on.

    And yes, I completely agree: I have no idea why these infoboxes aren’t supported natively by the software!

  26. I had the same problem on Dreamhost. Try putting this in LocalSettings.php: $wgScribuntoEngineConf[‘luastandalone’][‘luaPath’] = ‘/usr/bin/lua’;

  27. It does not work for me:
    When I attempt to impot as my admin user, I get an error:
    Forbidden

    You don’t have permission to access /index.php on this server.

  28. I have (nearly) successfully implemented your method here. The infobox appears as it should. However, I also get the following message at the top of my page:

    {{#ifeq:|Template|{{#ifeq:Oil/Oil|Infobox|}}}}

    Any ideas how I can get rid of this? The code does not appear in the Edit tab – only in the read tab, after putting your infobox code in place.

  29. Hi there, I’ve Exported the infobox templates and Navbox templates, I’ve installed and imported all the relevant templates and modules associated along with all the extensions.

    I have done a test for the infobox and the navbox, no errors come up, however for both infobox and navbox there is no proper formatting, they just appear as text. No table or box appears like how it should on wikipedia.

    I can’t seem to pinpoint what controls the table/box. The infobox also doesn’t align to the right hand side, it just sits right underneath the other text

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.