Manual talk:LocalSettings.php/Archive 1

Latest comment: 9 years ago by Jörgi123 in topic Sample file


Basic question *HOW* to edit!?

It's assumed here, in the documentation of LocalSettings.php, that the readers knows where this file is.

It would be kinda helpful if the documentation told me that.

You might think that "gee, if you need to edit LocalSettings then surely you know where it was installed." But that is not the case. In my case (just as one example) I have had a mediawiki installed for me on a hosted serverr.

Now the first thing I want to do is change $wgLogo. It's proving hard to do...

How to change $wgLogo:
  1. you have to edit the file LocalSettings.php which will be in the main directory of you wiki-installation
    • always good to do: copy the original LocalSettings.php to LocalSettings.php.backup (just in case)
    • change the value of $wgLogo
  2. activate the changes (just hitting the refresh-button doesn't help always. Probably depending on the browser settings...)
    • hit the refresh-button in you browser. You might also have to delete the cache to make the changes visible!

I have a question: I'm on my wiki. How can i reach the file and what i need to do to edit it? -20eric06

LocalSettings.php is not editable from the wiki (probably because this would create massive security risks). To edit this kind of file, you need a way to edit files on your server's file system. Evidently, the authors of the LocalSettings.php help assume the reader is the same person who installed MediaWiki on a given server. If you have the skills to get through Help:Installation, then you have the skills to edit any of the setup files such as LocalSettings.php. Obviously this assumption fails for the potentially large class of MediaWiki sysops who hired a Web hosting service to install MediaWiki for them. If you hired someone else to install MediaWiki for you, then you are left with no obvious way to get at LocalSettings.php, that is if you rely on the MediaWiki documentation as your only information source.
The situation is not entirely hopeless, because every Web hosting service must provide some way for the customer to change files on the server. To find out the method(s) you can use, contact your Web hosting service or look on their Web site for documentation. The details will vary from one service to another, but every hosting service customer needs to change files on the server, somehow, so any competent service will tell you how they let you do this. Here are some methods your service might use:
Note: something like my explanation above probably belongs in a help page here aimed at MediaWiki sysops who had a Web hosting service install MediaWiki for them. — Teratornis 17:39, 7 September 2006 (UTC)
If you hire a Web hosting service to install MediaWiki for you, you might benefit from also installing MediaWiki on your own Windows computer, so you can experiment with customizing it. It would probably be cheaper to prototype with your own MediaWiki install, where you won't be getting billed by the hour; then when you know exactly what to change, you can contact your Web hosting service to see about making the same changes on their server. If you learn what is going on behind the wiki interface, things like LocalSettings.php will make more sense. Teratornis 20:27, 7 September 2006 (UTC)
I have finally added according information to Manual:LocalSettings.php. This should really fix this shortcoming. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

Location and rights

I have two LocalSettings.php -files, one located at ./ and another at ./includes/. Which one's the one to edit? Furthermore, what rights should the file have? At the moment, no changes I make result in any changes. The mode is at 660 (I don't have the rights to change the mode). Thanks for any answers 193.229.103.232 09:25, 16 May 2006 (UTC)

The first one, locted in ./ is the right one. I have just added that to the article. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

Where do I find LocalSettings.php?

How do I edit LocalSettings.php? My Wiki's address is http://smashbros.elwiki.com/ (there's no "wiki" in articles, so an article would be at smashbros.elwiki.com/Main_Page). The question is: where is that file? --Smiddle 213.64.166.76

You should ask ElWiki themselves. There's an e-mail address on their front page, elwiki AT Zone-MR DOT NET; alternatively there may be some kind of support tool when you're logged into the site. I don't know, I'm afraid; I'm not registered on that site. RichF 16:34, 21 August 2006 (UTC)
I tried to enter smashbros.elwiki.com/LocalSettings.php, and I get the following message:
"This file is part of MediaWiki and is not a valid entry point"
I try to edit it, smashbros.elwiki.com/LocalSettings.php&action=edit, and I'm only editing a regular article called LocalSettings.php.
Edit: I tried /includes/LocalSettings.php, and it redirects me to an article called 403.shtml. I can just say one thing: I'M A NOOB --Smiddle 19:43, 1 September 2006 (UTC)
LocalSettings.php is a file on the filesystem that you need to edit. It's not a wiki article, or something you can edit through the wiki site itself. You need to be able to modify the file on the server itself. I don't know if ElWiki allow you to edit LocalSettings.php, and if they do, I don't know how. You will need to e-mail the people who run the site. Sorry. RichF 19:49, 1 September 2006 (UTC)
oh snap. I'll try that then. --Smiddle 19:52, 2 September 2006 (UTC)
Fixed in the article. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

Where is this file?

I believe that if I find the LocalSettings.php file, I can translate all of the namespaces (currently in English) into my language wikipedia.

Unfortunately, no matter what I try, I cannot seem to locate this file.

I notice that many other people have asked this same question, but I have not found any answer.

See my comments above in Basic question *HOW* to edit!?. It sounds like you don't have access to the file system on the server that hosts your MediaWiki software. If you did, and if your server runs a Unix-like OS (which I believe is true for all the language Wikipedias), you could probably find your LocalSettings.php with a find command like this:
  • find / -iname 'LocalSettings.php' -print
If you need to prototype some complicated MediaWiki setup, you may be better off installing your own MediaWiki to practice with, and then when you know exactly what you want to change, contact your Web hosting service (which in this case sounds like it would be the system administrators for your language Wikipedia, that is, the people who have file system access to the servers rather than merely administrator access through the wiki interface). — Teratornis 03:42, 8 September 2006 (UTC)
  • find / -iname 'LocalSettings.php' -print was exactly what I needed. It's not a production server, just a test, so I can't do much harm. I just needed to know where to go. Thanks! --108.221.18.180 20:03, 24 September 2013 (UTC)
Additionally to the hole text I wrote, I have also added this code into the article - of people now still do not find the file, then I don't know either. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

What do I have to do? The rest of the interface is mostly translated, only the namespaces are still in English. Thanks for anyone who can help. Codex Sinaiticus 07:10, 27 August 2006 (UTC)

Translated text, including namespace names, can be found in the languages/Language*.php files. Usually, if Wikipedia has been translated into a particular language, the namespaces will have been done at the same time. Which language are you translating into? RichF 22:06, 29 August 2006 (UTC)
I am the one who did the interface translation into Amharic myself, by modifying the Mediawiki files on that wikipedia over the past year as admin. But there is no way I can change the namespaces myself, that I know of.
On a related note, on the preferences, "amharic" (am) shows up as a choice for the interface only on the Amharic wikipedia.. It would be amazingly cool if this choice could be added with all the other languages for the other wikipedias, so that the Amharic interface I have designed could be used with any language wikipedia. Most of the small languages that are already available for interface on all the wikipedias in the preference section, are not even translated at all yet, and end up being English by default. Can you put a "bug" in some developer's ear about that? Thanks Codex Sinaiticus 15:30, 31 August 2006 (UTC)
Below is an excerpt from languages/LanguageFr.php, which is the French translation. This part of the file is providing French text for the namespaces. I haven't done a translation myself, but looking at this file, it does seem to be possible, and editing the LanguageXx.php file seems to be the way to do it. RichF 19:52, 1 September 2006 (UTC)
/* private */ $wgNamespaceNamesFr = array(
        NS_MEDIA                        => "Media",
        NS_SPECIAL                      => "Special",
        NS_MAIN                         => "",
        NS_TALK                         => "Discuter",
        NS_USER                         => "Utilisateur",
...several more lines like these...
        NS_HELP_TALK            => "Discussion_Aide",
        NS_CATEGORY                     => "Catégorie",
        NS_CATEGORY_TALK        => "Discussion_Catégorie"
) + $wgNamespaceNamesEn;


!!!H E L P!!!

Is it me or is this question simply *not* getting answered? Or maybe I'm in the Twilight Zone!!! I'm running *my own* MediaWiki install on *my own* Linux box and have access to everthing; everything, that is, EXCEPT 'LocalSettings.php'!!! Why? Because I can't find it either!!! I installed MediaWiki into username/public_html/wiki like a good boy. This is the 'main directory' referred to above. And it's *not* there!!! Did the find / -iname 'LocalSettings.php' -print thing too. Negatory maximus... Can someone please tell me where this @!#$ file is? I'm not too proud for a 'LocalSettings.php For Dummies'!!!

The LocalSettings.php file is created by the installer. Run the installer: visit your wiki with your browser (at http://localhost/wiki or whatever) and follow the instructions. When you are through, the last step is to move the freshly generated LocalSSettings.php to the right location, to make it go live. You can edit it before or after moving, as you like. -- Duesentrieb 22:14, 9 May 2007 (UTC)

KenPem -- I'm also running MW on my own Linux box, and there's no tract of this file. Very odd, as I assume (please correct me if wrong) that the Wiki won't work without it. Should I just create one?

Securing this file

Nowhere can I find instructions on the generally accepted way to secure LocalSettings.php. This file sits in my root directory and contains plaintext passwords. Do I just chmod 700? Is that the only level of security provided? It seems like an awfully big risk. If someone does know a generally recommended way to secure this file, it should be listed both on this page and on Manual:Installing MediaWiki. — Epastore 15:37, 28 May 2008 (UTC)

The php/web user needs to be able to access the password in order to contact that database. So, it can not be secured against access by that user. Encrpyting it in some way would just be obfuscation, since the means for decrypting would have to be available to that user too.
Since access by other users is prevented by the 700 access mode, I don't see a problem here. A second line of defense would be telling the database server to only accept connections from localhost or at least only the local lan. This is standard procedure and would prevent anattacker from accessing your database even if the password should be leaked.
I don't know, and can't think of, any other way for web applications to secure the passwords they used for accessing the databse. Its the same for a normal multiuser system: your database password sits in ~/.my.cnf as plain text and is protected against access by others only by the file's mode. -- Duesentrieb 16:08, 28 May 2008 (UTC)
So is that what you do, just change the posix permissions? I am looking for some sort of generally accepted practice. What does Wikimedia do?
Relying only on posix permissions seems to mean that if the server happens to have a hole (such as a newly discovered hole in php or apache for which there is not yet a patch), then my site could be effectively rooted. The most common exploits I see are "escalated privileges," i.e., breaking posix permissions.
And shouldn't this security practice be documented somewhere? The default installation leaves the database password open to anyone who can browse to that file, does it not? Or does the .php suffix act as a basic level of security?
As for the user needing the permission... it also means that anyone with ftp to the mediawiki directory can see the database password. Sometimes people are given ftp without being given full reign over the database, are they not?
These are genuine questions... I am a newbie and would love to be proven wrong about any of the above. :) — Epastore 21:36, 28 May 2008 (UTC)
One thing that you can do is create and use a limited database user. Add a single purpose user that only has access to the wiki database and grant it select, insert, update and delete permissions. I'm going over to add a note about this to Manual:Config_script so that it's at least listed somewhere accessible. — IvoLucien 20:05, 31 May 2008
I added the information on a restricted MySQL user and on the connection restriction for the MySQL server to the article. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

HTTP Error 500 when LocalSettings.php permission set to 600

I've migrated a site to a new host and domain. Everything went perfectly and the site is working, except.. The permissions for LocalSettings.php when I moved everything across defaulted to 744. When I changed them to 600 to secure the site it stopped working with a HTTP 500 error.

Which permissions are necessary depends on the server setup: If 600 is not enough, you might want to try permissions 640 or if that does not work 644. --88.130.89.88 11:09, 25 April 2014 (UTC)
According information added to the article. --Jörgi123 (talk) 15:12, 30 April 2014 (UTC)

No title

It said "Don't edit this file with Notepad, TextEdit, or other text editor that adds byte order marks to files, or you will break your wiki." so what can I use to edit it?--一個正常人 (talk) 12:28, 26 September 2012 (UTC)

Notepad++ and Vim are both good options.--Jasper Deng (talk) 15:14, 26 September 2012 (UTC)
Thanks.--一個正常人 (talk) 08:57, 28 September 2012 (UTC)
Haha, that's funny. One of the reasons I avoid Notepad++ like the plague is that when I've used it to edit simple ASCII files in the past, it screwed the file up by changing the encoding. I have used notepad ever since and it left my ASCII files as ASCII (Windows XP and Windows 7).
But for LocalSettings.php it's optimal. For one thing it doesn't insert byte-ordering marks (I learned this the hard way on my first attempt at installing MediaWiki myself).--Jasper Deng (talk) 21:42, 24 November 2012 (UTC)
Fixed. I have just added that to Template:BOMWarning. --Jörgi123 (talk) 13:44, 30 April 2014 (UTC)

What type of text editor to use?

It says, "Don't edit this file with Notepad or other text editor that adds byte order marks to files, or you will break your wiki." What is a better text editor to use? Metapad? Tisane 02:40, 24 February 2010 (UTC)

In reference to this edit, I understand the concern about advertising any particular software, but it would be a useful service to site administrators to provide some guidance as to what text editors are safe. Of course, we can't include a bunch of software names on the LocalSettings.php page, but maybe a link could be provided to a list of suitable and unsuitable text editors? Tisane 22:46, 1 March 2010 (UTC)
I wish they were more specific about what the problem is. I've used Notepad to edit LocalSettings.php for use on both windows and linux installations and have never had it create a problem. --Jerry Fallon 22:32, 13 October 2010 (UTC)
Any php editor would work Natkabrown (talk) 11:47, 29 May 2013 (UTC) - with help of Yaron Koren
Fixed. I have just added that to Template:BOMWarning. --Jörgi123 (talk) 13:44, 30 April 2014 (UTC)

Help needed to repair localsettings.php

Hi all

I need help repairing my localsettings.php after accidentally using notepad to edit it (adds byte order marks to file), please could the answer be in baby steps, I'm very new to this. Currently it's just giving me a blank page rather than the wiki I've been working on.

Many thanks

Mrjohncummings (talk) 13:06, 21 August 2013 (UTC)

I have just added that to Template:BOMWarning. --Jörgi123 (talk) 13:44, 30 April 2014 (UTC)


Should I save Localsetting.php as utf8 encoding ?

  • Mediawiki 1.9.3 in Chinese interface
  • OS windows server 2003
    • Apache Web Server Version 2.2.3
    • PHP Script Language Version 5.1.6
    • MySQL Database Version 5.0.24a

If I want to use some ExtraNamespaces in Chinese, I have to save Localsetting.php with utf8 encoding. But sometimes some error will occur, for example, the setting in common.css page will be desable and some functions will become unstable.

When I save it with other encoding, like big5 encoding, the ExtraNamespaces in Chinese will be unable.

Now, I save Localsetting.php in English and insert a line like followed:

require_once( "$IP/extensions/ExtraNamespace.php" ); 

The ExtraNamespace.php is a utf8 encoding file and the content of the file is the setting involved with ExtraNamespaces. Then all problems I've met will be solved.

Can I do it by this way? or I should not use any ExtraNamespaces in Chinese. But I've tried to set all ExtraNamespaces in English and change the file .\languages\messages\MessagesZh_tw.php, but I always failed. Perhaps I don't know how to edit the MessagesZh_tw.php. any ideas? --Roc michael 16:12, 13 July 2007 (UTC)

You can save all your PHP files with "ANSI as UTF-8" encoding - that is UTF8 encoding without BOM. That is also what the MediaWiki core uses for PHP files with special characters. --Jörgi123 (talk) 17:43, 30 April 2014 (UTC)

Language

The wgEmergencyContact variable is the e-mail address of the user to contact if something goes wrong. This e-mail address is used to send internal bug reports to. As an administrator, you want to include your e-mail address here.

I just fixed that. --Jörgi123 (talk) 13:44, 30 April 2014 (UTC)

Problem After Editing LocalSettings.php

On several occasions, I have have tried editing LocalSettings.php by adding "require_once" extensions toward the end (but before the >? characters). This was after uploading the correct php files to the correct directory. After saving, my wiki cannot load. There's no error message--there's just nothing there. It's blank. If I delete the line I added, the wiki comes back just fine. I've edited other variables and it's fine. Let me know if you have any suggestions for this issue. Thanks. Corsulian 01:01, 28 December 2007 (UTC)

Make sure that you are getting the correct variations of the Cite and ParserFunctions extension for your PHP version. I think Cite is fine, but the current version of ParserFunctions requires PHP 5 in order to run (and since you're running MediaWiki 1.6.10, I'm assuming you only have PHP 4). Try getting the other version of it and see if that works. And as for your logo, try changing $wgLogo to an absolute path to the image. --Skizzerz talk 15:14, 28 December 2007 (UTC)
Thank you. It does appear that I am stuck with PHP 4. I'll see if that changes things. As for the image, I am currently using the absolute path. I'm a little concerned that I can't find any reference to these issues from anyone else. I'm hoping that I'm not missing some enormous step in my configuration somewhere--I installed the wiki through one of those automated "here's a bunch of free programs you can use" modules through the admin panel that my host provides. Corsulian 16:25, 28 December 2007 (UTC)
Ok, you're setting the wrong path to the logo, which is why it's not appearing. Try $wgLogo = "http://www.corsulian.com/wiki/images/4/4b/Corsulian%27s_Wiki.png"; instead (you were linking it to the image page, not the image itself). --Skizzerz talk 16:57, 28 December 2007 (UTC)
Thank you--fantastic. The logo is fixed and the ParserFunctions extension is installed. I was expecting it to fix a few issues I had with the NavBox template but no such luck--I'll look into that more. I haven't found a PHP4/5 differentiation with the Cite extension yet--the "blank" problem remains at least for now. I'll continue looking into it--please, anyone, let me know in the meantime if you have specific experience with Cite.php and PHP4. I'll look to the Cite.php discussion page for more details otherwise. Corsulian 21:40, 28 December 2007 (UTC)

Comments

The comment signs in the default localsettings.php are # or ##, is there any reason for this? It seems to me // or /*...*/ works too, but can this make any problems? --Lastwebpage 14:50, 22 April 2011 (UTC)

Comments in PHP are delimited by #, // or /* ... */, there should be no difference with any of these three methods. iAlex 15:13, 22 April 2011 (UTC)

Sample file

Is there an example somewhere of a working current-version LocalSettings.php? Regards, Guido den Broeder (talk) 22:19, 16 August 2014 (UTC)

The exact content of LocalSettings.php changes based on user input during installation and based on the different MediaWiki versions - offering one here does not create much benefit. --88.130.116.224 16:56, 2 September 2014 (UTC)

At least a link to the current source generator could be given in the article. Jidanni (talk) 12:37, 23 June 2015 (UTC)

Agreed - what is that link? --88.130.88.162 22:23, 23 June 2015 (UTC)
Something like https://doc.wikimedia.org/mediawiki-core/master/php/LocalSettingsGenerator_8php_source.html Jidanni (talk) 23:30, 23 June 2015 (UTC)

I have added an according link. --Jörgi123 (talk) 11:38, 2 August 2015 (UTC)

Return to "LocalSettings.php/Archive 1" page.