How to install WordPress in a local XAMPP environment
[gss-content-box color=”red”]Content box text.[/gss-content-box]
The most common use case scenario for having a XAMPP local development environment is to install WordPress. In this article I will show you how you can install WordPress in XAMPP in order to test themes, plugins, develop new ones etc.
[gss-content-box color=”red”]Note: As a prequisite you will need to have XAMPP installed on your machine; you can check this article on how to have it setup.[/gss-content-box]
Steps for the WordPress installation
Step 1 – Download WordPress from wordpress.org
We need to download the WordPress kit from the “wordpress.org” website. The archive is offered either as a zip file or as a tar.gz file. At this stage – if you didn’t install XAMPP, I advise you to do it as we need it to have WordPress installed.
The current WordPress version is 3.8 – Parker. You can download the kit from here – http://wordpress.org/download/
In the end we will end-up with the kit archive:
Step 2 – Copy the WordPress kit to the XAMPP folder
We need to copy the WordPress kit to the XAMPP folder – more precisely the “htdocs” folder.
Step 3 – setup the permissions
We also need to change the permissions on the WordPress folder to allow web-server changes (like setting up the permalinks, install new themes, plugins etc.)
[gss-content-box color=”red”]Note: I am using PCManFM – file manager and this is the way it displays the permission; the “Files” file manager displays in a different way the permissions – see the below screenshot. In the end the equivalent for this is to setup the access level to 777.[/gss-content-box]
The permissions for the same folder as seen by the Midnight Commander terminal file manager.
Step 4 – create .htaccess file
We need to create a “.htaccess” file in the WordPress folder; this will help setting up the permalinks in the WordPress interface. We also need to setup its permissions level to 775.
Step 5 – create a database for WordPress
In order to install WordPress, we need to create a database for it with the help of phpMyAdmin from the XAMPP interface.
We access “localhost/phpmyadmin” we input the root user and its password and we go to the “databases” section and create a new database – “wordpress”.
Step 6 – install WordPress
We start the WordPress installation by accessing in the browser – “localhost/wordpress”
Because we gave the web-server permission to write in the WordPress XAMPP folder, when we press on the “Create a Configuration File” button, WordPress will be able to create it’s own configuration file – “wp-config.php”. If it gives you an error, the installation procedure will ask you to create one manually by providing the necessary code; the file will need to be saved as “wp-config.php” in the XAMPP wordpress folder.
Next – start the database configuration
We will need to enter the database name that we created earlier in the process in the phpMyAdmin interface, the database user name and it’s password; also the database server host – “localhost” in this case and the table prefix.
[gss-content-box color=”red”]Note: for security reasons – especially on live production servers – it is strongly recommended to change the “table prefix” from the standard “wp” to something else – in this case “ad”. The reason for that is that the malicious attacks are scanning for default values in the WordPress installations and these help the attackers to identify the different settings thus “making their life easier” to crack open the WordPress site. [/gss-content-box]
Click – Submit – everything should be ready for the WordPress installation
We need to enter the Site Title, the username and password and than click on “Install WordPress”.
That’s it ! WordPress is installed in XAMPP!
You should see the below screen in the browser:
Step 7 – Test drive the WordPress XAMPP installation
After entering the username and password you will be presented with the administration section of WordPress.
If you click on the upper left corner on the “house” icon you will be able to see a live preview of the WordPress site.
One thing that I want to show you; you can install themes and plugins in the XAMPP WordPress installation either by copying them directly in the XAMPP folder (wp-content) or by using the WordPress internal function; the quickest way is to use the internal function. For this to work we need to fill in the FTP details. In the below screenshots, I want to install the Twenty Eleven theme.
The FTP settings that XAMPP WordPress will need to install the new theme:
By using the above settings, XAMPP WordPress will be able to download the theme and installed it in the XAMPP WordPress folder.
We can activate the theme and tested it out!