Because PHP files need to be processed by a web server, you need to tell Dreamweaver where the testing server is located. You also need to tell Dreamweaver the correct URL to use when testing your files. This tutorial assumes that you have established a local testing environment on your computer as described in the preceding pages.
In theory, you can locate your files anywhere on your computer, and Dreamweaver will copy them to the testing server when you use Live view, Live Data view, or Preview in Browser. However, this results in two identical copies of every file; instead it's common practice to store project files in a folder inside the root of the testing server, which is what you'll do in this tutorial.
This section covers the following topics:
You can also see video tutorials for Windows and Mac OS X users that guide you through this process.
To specify a working folder:
In Dreamweaver, select Site > New Site. The Site Definition dialog box appears with the Local Info category selected on the left. (Note: If the Basic tab is showing, click the Advanced tab.)
Click the folder icon next to the Local Root Folder text box and browse to your testing server's document root. The location depends on your operating system and PHP installation choice. If you installed XAMPP and MAMP, following the instructions on pages 2 and 3 of this tutorial, the document root is:
Note: If you chose the alternative installation options mentioned earlier, the document root is:
Create a new folder inside the web server's document root, and give it the name of your site, for example, MyWebApp. Select the folder you have
just created as your Local Root Folder.
Note: The name should not include any spaces or special characters. You should never use spaces or special characters in folder or file names for a website, because they cause problems on most PHP servers.
Select the Links relative to Document option. This is the most reliable setting for a PHP site.
Note: Selecting the Links relative to Site root option results in Dreamweaver using a PHP function called virtual(), which can cause problems with PHP include files on some servers. If you use site-root-relative links and encounter problems with Dreamweaver server behaviors, you need to replace any instances of virtual() in the code Dreamweaver creates with require_once() and a relative link.
To specify a testing server:
In the Site Definition dialog box, click Testing Server in the Category list on the left. (Note: If you can't see the Testing Server item, verify that the Advanced tab is selected in the Site Definition dialog box.) The Testing Server screen appears.
Select Local/Network from the Access pop-up menu.
Dreamweaver displays the local root folder you specified in the Local Info category in Step 3 in the previous section. Leave the folder unchanged.
In the URL Prefix text box, enter the URL you would enter in a web browser to request a page in your web application.
For example, if you followed the folder naming suggestions in this tutorial, then the correct URL prefix is: http://localhost/MyWebApp/.
The URL prefix should always specify a folder, rather than a particular page on the site. Also, be sure to use the same capitalization you used when you created the folder.
The next step is to create a MySQL database and user account.