XAMPP (if you have Windows)
• Learn more
MAMP (if you have Mac OS X)
• Learn more
This tutorial describes how to set up a development environment on a Windows or a Macintosh computer for building PHP web applications with Adobe Dreamweaver and a MySQL database server.
Setting up a PHP development environment for Dreamweaver requires a web server (such as Apache or IIS), PHP, and a MySQL database. Although you can install all three separately, it's usually much simpler to use an all-in-one solution, such as XAMPP for Windows or MAMP for Mac OS X.
Note: PHP can be used with most database systems. However, Dreamweaver's PHP server behaviors support only MySQL.
This setup tutorial shows you how to complete the following tasks:
• Install and run a PHP-enabled web server on your local computer • Install the MySQL database server on your local computer • Define a PHP site in Dreamweaver CS5
• Import data into MySQL and create a MySQL user account for your web application • Connect to a sample database
1. Setting up PHP for Windows
PHP pages need to be processed through a web server. So, to develop with PHP in Dreamweaver, you need access to a PHP-enabled web server and the MySQL database. It's also useful to have phpMyAdmin, a graphical interface to MySQL. All three components are open source software that you can use for developing, testing, and deploying web applications–and they are free!
You can install each one independently, but the quickest and easiest way is to use an all-in-one solution. The one chosen for this tutorial is XAMPP. If you already have a working PHP/MySQL environment, or want to use a different all-in-one installer, such as WampServer (http://www.wampserver.com/en/), go straight to Defining a PHP site in Dreamweaver. If you're a Mac user, see Setting up PHP for Mac OS X.
Before you start
XAMPP installs the Apache web server, which listens for requests on port 80. This is the default port used by most web servers, including Microsoft Internet Information Services (IIS). Only one web server at a time can listen on port 80.
If you have installed IIS on your computer to develop with ASP or ASP.NET, you must stop the IIS web server before installing XAMPP. Alternatively, you can install PHP in IIS using the Microsoft Web Platform Installer as described in Setting up an ASP development environment for Dreamweaver. However, if you install PHP in IIS, you need to install MySQL and phpMyAdmin separately; see Installing MySQL and phpMyAdmin on Windows (for IIS only) for more details. Installing XAMPP
Installing and configuring XAMPP is usually quick and trouble-free, but things do sometimes go wrong. If you run into problems, the best place to get help is in the XAMPP forum.
You must be logged into Windows in an administrator account.
1. Go to the Apache Friends website and download XAMPP for Windows. Choose the Basic package self-extracting RAR archive. 2. Close all applications on your computer, and double-click the EXE file you downloaded. A dialog box asks you where you want to install XAMPP. The default is C:\. If you select the default, the installer extracts all the necessary files to a new folder called C:\xampp. When expanded, the files occupy approximately 275MB. 3. When all the files have been extracted, the installer opens a Windows Command Prompt window, where you are asked to respond to a series of simple questions about installation options. Type y or n, depending on your preference, and press Enter.
After you have set the options, you should see a message telling you that XAMPP is ready. This is followed by a screen with a short menu (see Figure 1). Type 1 and press Enter to start the XAMPP Control Panel. Then type x and press Enter to close the Command Prompt window.
Figure 1. The final stage of the XAMPP installation process involves setting options in a Command Prompt window....