Manual:LocalSettings.php/es

El archivo LocalSettings.php proporciona una serie de opciones de configuración básicas (basadas en el archivo ) de una instalación de MediaWiki. Deberías tomarte tu tiempo para revisar la configuración de este archivo. El archivo normalmente lo genera el instalador web de MediaWiki, pero tal vez quieras ajustar algunos de los parámetros, posiblemente en sintonía con la configuración de Apache. Se puede usar un archivo llamado CommonSettings.php para instalaciones de MediaWiki configuradas como granjas de wikis.

Ubicación en el servidor
El archivo LocalSettings.php no es una página wiki y no puedes acceder a él con tu navegador. Es un simple archivo que se encuentra instalado en un directorio del servidor. Su contenido se genera durante el proceso de configuración inicial del wiki y el archivo resultante debe copiarse manualmente al servidor. El archivo debe ubicarse en la carpeta en la que instalaste MediaWiki, al mismo nivel que carpetas como includes/ y skins/ y archivos como api.php. Si este archivo no está en ese lugar, el wiki no funcionará en absoluto - si el wiki funciona, entonces el archivo está donde debe. En caso de que no sepas dónde lo has guardado, puedes introducir un comando como find / -iname LocalSettings.php -print en una ventana de terminal para localizarlo.

Seguridad
LocalSettings.php suele contener información sensible, como identificadores de acceso a la base de datos. ¡Esta información jamás debe revelarse al público! En caso de un fallo de seguridad en algún lugar del servidor, podría ocurrir que otros usuarios pudiesen ver el contenido de archivos que no deberían. A fin de mejorar la seguridad de tu información, deberías ajustar convenientemente los permisos UNIX sobre este archivo. El usuario de servidor web debe disponer de acceso a este archivo; si se trata de la misma cuenta que también es la propietaria del archivo, entonces puedes usar 600 como permiso. A veces el usuario del servidor web no es el propietario del archivo, pero se encuentra en el grupo de usuarios UNIX del propietario; en este caso, un permiso de 640 debería ser apropiado. Para una mayor seguridad, los permisos deberían ser todo lo restrictivos que sea posible.

Además, puedes crear un usuario de MySQL que sólo tenga acceso a la base de datos utilizada por el wiki, e indicar las credenciales de este usuario en LocalSettings.php. También puedes configurar tu servidor de base de datos de forma que sólo acepte conexiones de localhost: esto debería impedir el acceso desde el exterior en caso de que las credenciales salgan a la luz.

Contenido del archivo
Cuando edites LocalSettings.php</tt>, asegúrate de guardarlo de nuevo con la codificación correcta. Deberías usar la codificación "ANSI como UTF-8", es decir, codificación UTF-8 sin marca de orden de bytes (BOM).

LocalSettings.php</tt> contiene código PHP; principalmente, la definición de una serie de variables con sus valores correspondientes. Cambiar algo en este archivo normalmente conlleva cambiar el valor de una variable de PHP. Los cambios que hagas tendrán efecto inmediatamente en cuanto guardes el archivo de nuevo en el servidor. No hay necesidad de "reiniciar" nada manualmente; en todo caso, en determinadas ocasiones puede ser necesario que limpies el caché de tu navegador para poder ver el resultado de los cambios que has hecho.

Los valores predeterminados de muchos otros ajustes están definidos en, que no debes editar; si la variable que quieres cambiar no figura todavía en tu LocalSettings.php</tt>, copia la línea que corresponda desde   y entonces modifícala según convenga en LocalSettings.php</tt>. Dentro de LocalSettings.php</tt> puedes añadir nuevas líneas al final.

Dentro del archivo puede haber varias líneas del estilo ' ', que apuntan a extensiones. Estas líneas activan en el wiki la extensión a la que hacen referencia. Tales extensiones pueden, a su vez, necesitar que se definan más variables en el archivo LocalSettings.php</tt>; consulta la documentación de cada extensión para más detalles.

En MediaWiki 1.16 y anteriores era importante no colocar invocaciones a extensiones antes de la línea, puesto que en caso de hacerlo las matrices de funciones de la configuración de las extensiones se borraban, impidiendo su instalación y probablemente volviendo tu wiki inaccesible. Desde la versión 1.17 ya no es necesario que LocalSettings.php</tt> incluya el contenido de DefaultSettings.php.

Al igual que la mayoría de archivos PHP que emplea MediaWiki, LocalSettings.php</tt> no termina con la etiqueta de cierre de PHP. Esto evita que los administradores añadan accidentalmente información después de esta etiqueta. PHP funciona bien sin una etiqueta de cierre.

If you have a wiki on a MediaWiki wiki farm you may not have write-access (perhaps not even read-access) to the file LocalSettings.php</tt> (see e.g.). The wiki farm company may or may not be willing to make changes you desire. Perhaps it wants to keep most settings the same on all wikis of the wiki farm.

Pantallazo de las configuraciones disponibles
See the configuration settings index and the comments included in the settings files for help on what all the variables do. A short listing of the most important variables, as well as the most requested features, is listed below.

Include path
The $IP (include path) variable holds the local file path to the base installation of your wiki. Make sure you refer to the fully qualified file path. Do not include a slash at the end of the path. Since MediaWiki 1.17, setting $IP in LocalSettings.php</tt> is no longer needed. It will default to the current working directory automatically.

El archivo DefaultSettings.php desde el directorio designado por la variable IP.

Nombre del sitio
The $wgSitename variable holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "From Wikipedia, the free encyclopedia" makes use of this setting.

Declensions of site name
Some translations of interface are ready for inflection of site name. You can set proper forms of word in variables $wgGrammarForms (for example please refer to the $wgSitename documentation page).

Idioma del sitio
The $wgLanguageCode variable controls the language of your wiki's interface. While users can switch the language they see in their preferences, this variable sets the default language that all anonymous users and most registered users see.

Script path
$wgScriptPath is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki. This setting should correspond to the Apache settings, especially if you are using Apache's rewrite rules.

Nombre del servidor
$wgServer can be used optionally to overwrite the automatic detection. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, e-mail notifications and a few other computed messages would be usually delivered with the different URLs. Using  overwrites the detection and the server name will be constant.

If www.example.com is the server address of your wiki as seen from the internet, add a line such as

The magic word variable  can be used on wiki pages; it equals the value of  ; however, on a wiki, such as those in the WikiMedia family, where relative urls are used, it will not fully expand, for example here it displays, which can neither be clicked nor copy-pasted into the address bar as it is.

Script name
$wgScript is the name of the main (index) MediaWiki PHP script, named  by default. Changing the script name is probably not a good idea. However, if you feel the urge to do so, this is the place to make your changes. Make sure you know what you are doing.

Redirect script name
The $wgRedirectScript variable specifies the URL path to the redirect script which handles redirects in MediaWiki. This setting is similar to wgScript as you can configure the exact name of the script. As mentioned above, this is probably not a good idea unless you really know what you are doing.

Article path
$wgArticlePath is the path to use when accessing a page in MediaWiki. The path should contain the path to the main script (usually making use of ) and use the   placeholder for the article name.

If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust  to address the right path. Note that wgArticlePath is used to construct URLs from within MediaWiki. If you make a mistake here, internal links will show up incorrectly while you still may be able to access the main page by specifying the correct URL manually. See Manual:Short URL for more information on URL configuration.

Las valores típicos son:

Ubicación de la hoja de estilo
Use the $wgStylePath variable to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located. The $wgStyleDirectory variable should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.

Upload location
The upload directory is the place where files uploaded by the users are stored. The $wgUploadPath variable specifies the URL path, the $wgUploadDirectory points to the local file system path.

Logotipo
The $wgLogo variable specifies which graphical logo is displayed in the top left corner of all mediawiki pages. These steps replace the default logo in the /wiki/skins/common/images/ directory, replacing /wiki with the path to the directory where you installed the MediaWiki software.

First, copy whatever logo you want into the /wiki/skins/common/images/ directory (replacing /wiki with the path to the directory where you installed the MediaWiki software).

Next, try to find the line that looks like this in LocalSettings.php</tt>:

If there's no such line, you can copy and paste the line above at the end of the file.

Then, modify that line to point to your logo. The logo must be web accessible. The value of this variable is passed to the web browser, which uses it to fetch the logo. If in doubt, a good way to pick what to put here is navigate to the logo in your web browser (for example, this wiki the url of the logo is http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png ), and put the full url as the value of this variable.

Some people just replace the skins/common/images/wiki.png file with their logo. This is not recommended, as the customized logo would be overwritten on upgrade.

Información de contacto
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.

The $wgPasswordSender variable is the e-mail address where e-mail gets sent from, when passwords are sent out to users who have forgotten their passwords. Choose an address people can reply to in case of trouble or confusion.

Configuraciones de base de datos
MediaWiki needs access to the database (currently either MySQL or PostgreSQL) to store pages, modifications, user information, and a lot more things.

The $wgDBserver contains the hostname where the database is hosted on. In most cases this will be just "localhost" as the database is run on the same system, but for distributed installations, you need to fill in the fully qualified domain name of the computer running the database.

$wgDBname is the database name of the database to be used by MediaWiki. A single MySQL or PostgreSQL installation can store more than one database and you can even run many MediaWiki installations on a single server. Make sure you have stated the correct database name here and use different database names for different wiki installations on the same database server.

The $wgDBuser and $wgDBpassword variables contain the login name and password to be used by MediaWiki to access the database. Make sure the specified user has the proper access rights to be able to manipulate the wiki's table on the database server.

Derechos de usuario
The $wgGroupPermissions is an associative array, controlling permissions for creating and editing pages for your different user groups. In this array, custom permission levels can be created, and permission levels for the different user groups can be set. See Help:User rights for more information about the different permissions and user groups available.

Force capital links
By default, no page name can start with a lowercase Roman letter: in an attempt to do so the first letter is converted to uppercase; if a link target, included page, image or category is specified with a name starting with a lowercase letter, the actual target etc. is the page starting with the corresponding capital.

Alternatively page names can start with a lowercase letter, in addition to the possibilities of starting with a capital, a digit, etc. For that you must adjust the $wgCapitalLinks variable. Setting it to false allows lowercase characters, true chooses the default behavior.

Activando subpáginas
In LocalSettings.php</tt>, subpages are enabled on a per-namespace basis using the $wgNamespacesWithSubpages variable. For example, to enable subpages in the main namespace:

Image uploads
Before users are allowed to upload files to the MediaWiki system, you have to enable that feature. Make sure the Upload Directory is properly configured and writeable by the Apache web server process. Then set the $wgEnableUploads variable to true to allow uploading in the web user interface.

i.e. Here's some example code from includes/DefaultSettings.php to put in LocalSettings.php</tt>: If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working ImageMagick installation. Set the $wgUseImageResize and $wgUseImageMagick variables to true once you have installed and tested ImageMagick on your system. Make sure the $wgImageMagickConvertCommand variable points to the proper location of the  command of your installation, that the command is executable by the web server process, and $wgMaxShellMemory is large enough. See for detailed information and trouble-shooting.

Also, you may want to modify the list of accepted extensions, which is stored within the $wgFileExtensions array:

In case ImageMagick outputs an error message similar to the following:
 * Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506

then try adding the following line to LocalSettings.php</tt>:

= "file -bi";

Soporte interwiki
InterWiki support is built into MediaWiki but you need to configure the prefix to be used for your internal links. This prefix is usually the same as, but in case you need to change that, you set the variable to the preferred name.

Idioma de la interfaz de usuario
MediaWiki allows for a variety of localized user interfaces languages instead of the English default. If you want to run your wiki in a non-English language, set the variable to the proper language code (e.g. "de" for German, "es" for Spanish, etc.)

You may use any of the languages with a file in the directory. E.g. if you find es.json</tt>, then you can use  for Spanish. Do not use  with a capital letter. Although it seems to work, not all texts are translated.

Note: After changing the language code, you will need to run a PHP script to make it work. In a terminal window, change to your wiki directory, change to the maintenance</tt> folder, and enter. On Windows, the PHP folder might not be in your  environment variable and you'll have to prefix php with the path to the program.

Not all languages are supported. See here for a list of the localisation statistics of. See translatewiki.net for the statistics per released version.

Configurando los derechos de autor del sitio

 * $wgRightsPage is the page on the wiki that covers the copyrights that it falls under. Usually, this will be Project:Copyrights.
 * $wgRightsUrl is the page describing full details of your license. (For the GNU FDL, for example, this would be .)
 * $wgRightsText is the text in the footer that follows "Content is available under". It will be linked to the page specified in.
 * $wgRightsIcon is the URL of the image placed at the left of the footer.
 * Note: If  is non-empty, the link in the copyright/license notice will link to that page on your site. If   is empty then the copyright/license notice will link to   instead.

To modify the copyright statements of the site, add something like this to <tt>LocalSettings.php</tt>: Afterwards, edit MediaWiki:Copyright to provide an appropriate message, using  to indicate the position where the link to your copyright page will be.

Ejemplo: configurar una licencia Creative Commons

Para configurar una licencia Creative Commons haz lo siguiente:


 * Elige tu licencia: http://creativecommons.org/choose/
 * Examina el código HTML obtenido, p. ej.:


 * For  enter the href info from the first anchor:
 * For  enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
 * For  enter the src info from the img link in the first anchor. You want to copy the badge to your own site instead of using the one from the Creative Commons site.


 * For using RDF metadata about copyright add one or both of the following lines to your <tt>LocalSettings.php</tt>:

Espacios de nombres personalizados
By declaring the $wgExtraNamespaces array, and modifying the $wgNamespacesWithSubpages, and $wgNamespacesToBeSearchedDefault arrays, extra namespaces can be added to a MediaWiki installation; and by declaring the $wgNamespaceAliases array namespace aliases can be added. Take heed not to have any pages already titled in that namespace, for instance in you had a page called "Technical:Support" and you created the Technical: namespace, then that page would not only be lost, but you cannot remove it from Special:Allpages. To fix this delete the namespace, move "Technical:Support" to "Support" in mainspace, delete the redirect, reinsert the namespace, and move it back to "Technical:Support". See Custom namespaces for more information as to how to do so.

Apariencias
The default skin of the site can be modified via the $wgDefaultSkin variable.

Véase también

 * source code, which generates the inital contents of <tt>LocalSettings.php</tt> during installation.
 * Wiki families can share the same.
 * Extension:Configure provides a way to set configuration settings from a special page.
 * Manual:Securing database passwords - a guide to securing your database passwords and <tt>LocalSettings.php</tt> file.