How to set up a localhost in Dreamweaver on Windows

When building your sites locally using PHP, you'll need a localhost server set up to test your files.

If you have no idea how to set up your localhost, this tutorial will show you how to do so with Adobe Dreamweaver on Windows.
This tutorial is based on Dreamweaver CC, but can also apply to Dreamweaver CS6.

Step 1 - Install a PHP development environment

First you'll need a PHP development environment installed.
In this tutorial we'll be using XAMPP, which is the most popular one and can be downloaded here for free.

Step 2 - Create a PHP file

2.1 - Once XAMPP is installed, open Dreamweaver, click on 'File' in the top menu and choose 'New'.

2.2 - Make sure 'New Document' is selected, select 'PHP' and then click the 'Create' button.

Step 3 - Set up your localhost

3.1 - A pop-up window will ask 'To preview pages containing server-side code, you need to specify a testing server. Would you like to specify one now?'.
Click 'Yes'.
If the window doesn't pop up, click here.

3.2 - You will then be asked to choose your root folder.
Locate and open the drive where you have installed XAMPP, open the XAMPP folder and then open the 'htdocs' folder.
Then create a folder named as your website name under htdocs, as you'll see in the image below I have named mine 'mywebsite' and I have XAMPP installed on my D drive.
Click on your new folder once and then click the 'Select Folder' button.

3.3 - The next window that shows is the site setup for the localhost site.
Under 'Site Name' enter the name that you have just used for the root folder that you have created.
As you saw in step 3.2, I have called my root folder 'mywebsite', so as in the image below, I have put 'mywebsite' for the site name.

Then for the 'Local Site Folder' you must put the path where your new root folder is located.
You can also click the folder icon on the right to browse for your root folder.

3.4 - Click on the plus button to add a new server.

3.5 - Select 'Basic' at the top of the servers window that pops up.
For 'Server Name' use your root folder name again and then for 'Connect using' choose 'Local/Network' from the drop down list.

Then for 'Server Folder', you must put the same folder path that you used for 'Local Site Folder' in step 3.3 - the path for the root folder that you created.
As with step 3.3, you can also click the folder icon to browse for the folder.

Then for 'Web URL' type in 'http://localhost/' followed directly by the name of your root folder and then click the 'Save' button.

You will then be taken back to the 'Site Setup' window, make sure 'Testing' is checked and then click 'Save'

Before you can test your new localhost server, you need to open XAMPP Control Panel and start Apache and MySQL.
Go out of Dreamweaver and to the folder on your computer where you have XAMPP installed (as you'll recall, I have mine installed on my D drive) and double click on 'xampp-control' to open the XAMPP Control Panel.

In the XAMPP Control Panel, click on the Start buttons for Apache and MySQL.

Now go back into Dreamweaver, save your file as 'index.php' inside your root folder and your homepage is ready to be built on your new localhost server.
Press F12 to preview your new home page, or in the address bar of your internet browser enter 'http://localhost/', followed directly by the name of your root folder.