Installing Wordpress locally
To develop a template, solve problems or test something without taking risks with the weblog, a local installation of Wordpress can be helpful.
To do this you can use a local server like Wamp or XAMPP or InstantWP. The latter is simpler but only works with WP while others allow to locally test other software or scripts.
To install it with XAMPP is done in 3 or 5 steps depending on whether you choose the simple or technical method.
Simple method
1) Install XAMPP
Download the latest version and run the executable, it is automatic. Then click on the software in the Start menu to display the control panel.
2) Install the bitnami plugin
This plugin once downloaded and executed, installs itself in the xampp directory, it downloads and configure the latest version of Wordpress. You have nothing to do.
Bitnami.
3) Launch Wordpress
Show the control panel and click on Start in front of Apache and MySQL. Then open a browser and type this in the URL bar:
localhost/wordpress
That's it!
Technical method
1) Install the local server
If your site should use seo-friendly permalinks, with the option /%postname%, they will not work locally unless the rewrite module is enabled.
To activate it, open the XAMPP menu, open the Apache config, check on rewrite_module.
2) Install Wordpress
Unpack the Wordpress archive in
\xampp\apps\wordpress
It is also possible to use virtualhost to install multiple sites, but that is another matter.
3) Create a database
For this, we enter in phpMyAdmin from the XAMPP menu (MySQL Explore), and in phpMyAdmin, open the Databases panel and click on the Create a database link after entering the name chosen for the base in the input field below the link.
4) Fill wp-config.php
With the latest versions of WordPress, it is not necessary. Instead, we must delete the wp-config.php file and when you click on the wordpress directory in the list through Wamp, a creation process is initiated.
For it to work, you should not give the password if the database is already created (as above).
If you prefer to manually create the file, here is the procedure ...
At the the root of of the wordpress directory is the file wp-config-example.php. Rename it wp-config.php.
<?php // ** MySQL settings ** // define('DB_NAME', 'wordpress'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); // You can have multiple installations in one database if you give each a unique prefix $table_prefix = 'wp_'; // Only numbers, letters, and underscores please! // Change this to localize WordPress. A corresponding MO file for the // chosen language must be installed to wp-content/languages. // For example, install de.mo to wp-content/languages and set WPLANG to 'de' // to enable German language support. define ('WPLANG', 'en_EN'); define('WP_POST_REVISIONS',false); /* That's all, stop editing! Happy blogging. */ define('ABSPATH', dirname(__FILE__).'/'); require_once(ABSPATH.'wp-settings.php'); ?>
The name of the
database (DB_NAME): it is that
you created with phpMyAdmin.
"wordpress" is an example.
The username (DB_USER):
root
The password: none.
The server (DB_HOST):
localhost.
The charset: you choose,
the default is utf8.
The language you
choose, nothing for English, leave the string empty, otherwise enter the code, for example fr-FR and
install the corresponding mo file into /wp-includes/languages/.
Revisions are not part of the default config file, a line must be added to: disable them is your site does not work as a wiki, to avoid to overload the database.
define('WP_POST_REVISIONS', false );
5) Start
Click on the Wamp icon on the desktop to start the local server. The Wamp icon on the taskbar becomes green. Click it to let the menu appears.
Click on localhost in the Wamp menu. Click on wordpress. An error message appears, you must specify the full path:
http://localhost/wordpress/wp-admin/install.php
This can be done directly by typing this URL in the navigation bar of the browser.
Then click on install, and it is finished.
Importing the content of a blog
If you already have a blog online, you can retrieve its content with the export command on the site, and import it locally. This can be particularly useful to verify the compatibility of a new version of Wordpress with the database before installing it.
In this case, you have to increase the memory size allowed to PHP in the php.ini file in the php subdirectory of Wamp:
memory_limit = 64M ; Maximum amount of memory a script may consume (8MB)