The following guide will take you through the full process of setting up the server, creating a database and installing WordPress on your local computer.
I create WordPress themes, and I do all of my development work on a local server, rather than on a live site/domain. When I say ‘local server’ I mean that I have installed a local server environment on my PC – this allows me to have a WordPress installation directly on my computer that I can use to develop and test on. It is very straightforward to set up, and brings several benefits.
For example, because everything is happening locally, it removes the need for FTP transfers – changes to code are instantly viewable. It also provides the opportunity to test freely without worrying about causing a bottleneck on remote hosting provider’s servers. Themes and plugins can be developed in a closed environment and released to the outside world when everything is ready.
The following steps will take you through the process of setting up the server, creating a database and installing WordPress. This guide is for Windows, but the software used here can be downloaded for Mac also.
Download MAMP and Word.Press (both are free).
Install MAMP and reboot. Run MAMP.
Windows will prompt for firewall access for private networks for APACHE and MYSQL – accept both.
First we need to set the Web Server Document Root. This is where your Worpdress installation will reside. The path to this folder is set by MAMP as ‘C:\MAMP\htdocs’, but it can be changed as follows:
Open MAMP, and go to ‘Preferences’.
Then, go to the ‘Web Server’ tab, and set the Document Root to the desired path (the default is ‘C:\MAMP\htdocs’ – you can leave it as is, or choose your own location). Click OK.
Create a file called index.php and add some code to it, e.g:
<?php echo ‘<p>Hello World</p>’; ?>
Navigate to the MAMP Web Server Document Root folder (see step 3 above) in windows explorer: this is where you should place your newly created index.php file
Open your browser and go to: http://localhost/
You should see the following:
Now that the local server environment has been set up we can move onto creating a database.
Go to MAMP main menu
Click on ‘Open Start Page’.
Then, in your browser, click on ‘tools’ / ‘PHPMyAdmin’ as follows:
Create a new database. I called mine ‘designer’ but you can name it anything you like. Set the second dropdown to ‘utf8_unicode_ci’.
Extract WordPress installation zip to MAMP Web Server Document Root directory as follows (for download link, see step 1):
Open the WordPress folder you just extracted, then locate and open ‘wp-config-sample.php’ with your preferred HTML editor.
In ‘wp-config-sample.php’, find the following lines of code:
Firstly, change the database name (DB_NAME) to the same name as the database you created earlier (I called it, ‘designer’). Then change the DB_USER and DB_PASSWORD both to root, and save the file:
In your browser, open: http://localhost/wordpress
…and the installation process will now start.
Select your language, then after clicking ‘continue’, you will be presented with the following screen:
After clicking ‘Let’s go’, we are presented with a form.
We have to enter only 3 things:
1. Database name – (in my case: designer – see step 5 of this guide)
2. Database username – root
3. Database password – root
The remaining fields can be left as default:
4.Database Host – should already be set as ‘localhost’
5.Table Prefix – should already be set as ‘wp_’
Upon clicking ‘submit’ you should see the following screen, and WordPress is now ready to be installed:
Click on ‘Run the install’.
After installation is complete, go to the following URL to login and see your WP dashboard:
http://localhost/wordpress
Congratulations, you have just installed WordPress on your local system.