Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you create a Dreamweaver site that's designed to work with PHP, there are some additional steps you'll need to follow to associate the site with your PHP server on your local system. I'll start with the site that's already been created named, DW CS5 with PHP and MySQL. I'll go to the Menu and choose Site > Manage Sites. Then with my site definition selected I will click Edit. Before I can figure the testing servers, I will reset the Local Site Folder for this site definition to another copy of the site files.
I will click the Browse icon, then I will go up one level in the disk file system to the 02_gettingstarted chapter folder and then go down to the exercise folder, 02_testingserver, and then I will click Select. I will click Save, and if see this message that the cache will be recreated, I will click OK and then click Done. That's a process you will need to follow on each exercise, re-pointing the site definition to the files for that exercise, and then looking at the Files panel, I will confirm that I have a full set of files in that directory.
Here are the steps for setting up the testing server. I'll return to Manage Sites dialog and with the site definition selected, I will click Edit. I will go to the Servers category. In the Servers list, I will click the plus icon to add a new server. I am going to be working with my copy of PHP and Apache on my local system. So I am going to name the server simply, Local Server. You can name the server anything you want at this point.
For this option, Connect using, I will choose Local/Network, meaning that I'll be connecting to the Server's hard disk through the local file system. I'm going to set up a Server Folder which will be under my server document root. On Windows with WAMP server, this will be C:\wamp\www, and on Mac using MAMP, it will be /Applications/MAMP/htdocs. I am working on Windows with WAMP server, so I will click the Browse icon; I will start off at the computer in the C drive root.
From there I will go down to wamp and then to www. If you are working on Mac, browse to /Applications/MAMP/htdocs. Create a new folder; this will be the testing folder for the current site. I'm going to name it dwwithphp. The name of this folder should contain no spaces and should be all lowercase. I'll click Open and then click Select, and that sets the Server folder to the location on disk where I'm going to copy my files for testing.
Then click into the Web URL. The web URL will be the same regardless of whether you're working with WAMP server or MAMP. It'll be http://localhost/dwwithphp. You are matching the name of the folder in the web URL to the name of the folder in the server. Local host points to the server's document route and the rest of the directory name is relative to that location. Next click Advanced at the top of the screen.
Don't worry about the Remote Server settings. We are setting up a testing server. So under Testing Server, pull down the list of available server models and choose PHP MySQL. Click Save, that takes you back to the server list. With your new server selected, uncheck Remote and check Testing. This means that the server will only be used for testing and we won't be actively uploading files for production. Later on if you need to make changes to this server definition, you can reopen this dialog box and click the Edit button in the form of a pencil.
I'll Save all of my changes and then click OK, and then in the Manage Sites dialog, I will click Done. I'll show you what happens when you test a page from a PHP associated site. I'll open the file index.htm and then I'll test in an external browser. I will go to the Preview/Debug button in the toolbar and choose Preview in Firefox. Notice that I am asked whether I want to update the file on the testing server. You may or may not see this dialog depending on how you have Dreamweaver configured.
If you do see it, click on Yes, and then in the Dependent Files dialog, click on Yes again. If you don't see these dialog boxes, asking you whether you want to copy files to the testing server, you can turn them on in Dreamweaver's Preferences dialog box. Once you open the Preferences dialog, go to the Site category and check the option, prompt input/check in. Click OK to save your changes and preview the page in an external browser again.
You should see the dialog boxes appear. When the page opens in the browser, if you don't see any graphics, click the browsers Refresh button to make sure you're seeing the latest version. That means that before you test the page, Dreamweaver will make a copy of the page in your web directory along with any files on which it depends, graphics, cascading style sheets, XML, Flash content, and so on. In the external browser, take a look at the web address that's been used to test the page.
Notice that you're browsing the page by requesting it from the web server, through the local host address, not loading the file from the local disk. This will enable the web server to dispatch requests for dynamic pages, such as PHP pages, to the appropriate application server for processing. Now I'll close the browser and return to Dreamweaver and close this page. Now let's see what happens with a PHP page. I will go to the Files panel to the index.htm file which is the homepage.
Then I will rename it, I will right- click on it and choose Edit > Rename, and I will change the name of the file from index.htm to index.php. When I press Enter or Return, Dreamweaver detects all of the references to this page in any of the other pages of the site and asks me whether I want to update the links. I will click Update and Dreamweaver accomplishes the update throughout the site, and then I'll double quick index.php and I'll run the page in the browser.
Once again I'm asked whether I want to update the copy on the testing server and in the secondary dialog, whether I want to put the dependent files. I will click Yes for both dialogs, and now I should say that the browser is loading the PHP version. So if you've gotten this far, you're successfully testing your PHP file by requesting it from the web server, which dispatches the request to the PHP server, which processes the file and sends content back to the client, the browser, through the HTTP server.
If you're having trouble with this, make sure that your server is running, either WAMP server or MAMP, and also make sure that you can load HTML files correctly using the localhost web address. If everything is working, you're ready to start creating your own PHP pages.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 87476 Viewers
80 Video lessons · 136427 Viewers
59 Video lessons · 55089 Viewers
52 Video lessons · 68948 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.