Jump to content

Manual:Installing MediaWiki on XAMPP

From mediawiki.org

XAMPP can be used to get an environment for your MediaWiki installation up and running pretty quickly on your local machine or for a portable version on a USB drive if you use XAMPP Portable version.

Getting Apache and MySQL running

[edit]
  1. Download the latest version for your platform (Linux, Windows, Mac OS X, or Solaris) from apachefriends.
  2. Run the executable to extract it (you can extract it straight to C:\ if you want; it'll create an XAMPP subfolder and put all the files there) and answer the questions setup will ask you. Rename the folder to XAMPP. The minimum required components are Apache, MySQL, PHP and phpMyAdmin.
  3. At the end, setup will give you an option to start the XAMPP control panel; select that option and it should pop up.
  4. Check the checkboxes for Apache and MySQL and click on their respective Start buttons to start those.
    1. If a port conflict occurs when starting the Apache web server, then the port for Apache must be changed, e.g. change 80 to 8080 (httpd.conf) and 443 to 4433 (httpd-ssl.conf). The service ports in xampp-control.ini must be changed in the same way.
    2. You may encounter a MySQL port conflict in XAMPP if you have installed MySQL before in the system. In this case you need to change the port number for XAMPP. For example: https://stackoverflow.com/a/39741578/5632906.

Creating your database

[edit]
  1. Direct your browser to http://localhost/dashboard/ (or e.g http://localhost:8080/dashboard/ if the port has been changed to 8080)
  2. Go to phpMyAdmin at the top of the page
  3. Sign in
  4. Click Databases on the top bar.
  5. Choose a name e.g. wikidb, select a collation e.g. if your wiki is using utf8 for its default character set, then choose utf8_unicode_ci, and click Create)
  6. Go into the new database and click on Privileges on the top bar.
  7. Click Add user account
  8. Enter a name for the user (e.g., wikiuser) and a password. For the hostname, select Local/localhost. You can leave all the rest blank. You may want to write down your database name, user name, and password, because you'll need those to install MediaWiki.
  9. Click the radio button for "Grant all privileges on database "xxx"
  10. For Global privileges select check all
  11. Click Go.

Editing PHP.ini

[edit]

To make sure that the Apache HTTP server doesn't time out while creating the databases, modify the php.ini config file:

  1. Open the php.ini file< (can be found in the folder /path_to_xampp/php; in most Linux distributions, this file has the path /opt/lampp/etc/php.ini) using your favorite text editor. Find the following section and change to max_execution_time = 600.
  2. Look for "Dynamic Extensions" and make sure extension=intl is uncommented. If you have uncommented it you will need to restart Apache to load the extension.

Setting up MediaWiki

[edit]
  1. Download MediaWiki
  2. Extract all your MediaWiki files and folders into a subfolder e.g. mywiki\ of the htdocs folder, wherever that is e.g. c:\xampp\htdocs\.
    MediaWiki is downloaded as .tar.gz file. To unpack such archive the following command can be used in Windows cmd or PowerShell:
    tar xzvf mediawiki-{{MW stable release number}}.tar.gz
  3. Direct your browser to the appropriate page, e.g. http://localhost/mywiki
  4. Follow the MediaWiki installer's instructions, entering the user name, and password you wrote down during the "creating your database" step above. Use 127.0.0.1 for the database name.
  5. If you enabled the "security" option, then you need to Use superuser account. This means the MySQL root account and its password.
  6. After MediaWiki tells you that everything went smoothly, save your LocalSettings.php file to your wiki's root folder, e.g. c:\xampp\htdocs\mywiki.
  7. Direct your browser once again to the appropriate page, e.g. http://localhost/mywiki. It should take you to the Main Page of your new wiki. Congratulations! You're done.
  8. Add any extra extensions your wiki is going to require.

Backing-up

[edit]
  1. In SQL admin, go to the wiki database (typically wikidb), and click Export. Check the first box under "structure" (DROP TABLES), and check the "save as file" checkbox near the bottom. Click Go and save the file to the backup location.
  2. Save a copy of the wiki folder, e.g. mywiki from c:\xampp\htdocs\mywiki to the backup location.

Restoring

[edit]
  1. Install XAMPP on the new server.
  2. In SQL admin:
    1. Create a new blank database with the default options and a name of your choice.
    2. Import the database file you backed-up.
    3. Change the SQL password of the root for that db (in privileges tab)
  3. Copy the wiki folder from back-up into the new htdocs folder.
  4. Change LocalSettings.php to reflect the new db username and password.

Maximum execution time exceeded

[edit]

If you get Fatal error: Maximum execution time of xx seconds exceeded ..., edit the file config.inc.php in folder phpMyAdmin and set:

$cfg['ExecTimeLimit'] = 0;

See also

[edit]