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 a graphical interface to MySQL.
The Apache web server and PHP are preinstalled in Mac OS X. However, they're not enabled by default. Moreover, the preinstalled version of PHP lacks a lot of useful features, and you need to install and configure MySQL separately. Unless you're very comfortable working with the command line in Terminal, it's much easier to install the all-in-one solution MAMP.
This section describes how to install MAMP on your Mac. This installs the Apache web server, MySQL, and a MySQL front end called phpMyAdmin in a single operation. All three components are open source software that you can use for developing, testing, and deploying web applications. What's more, they're free.
Note: You can also purchase a license for a commercial add-on called MAMP PRO. This makes it easier to organize your sites. However, the free version is perfectly adequate for developing PHP pages with Dreamweaver, so MAMP PRO is not covered here.
If you're a Windows user, see Set up PHP for Windows.
This section covers the following topics:
Instead of using the preinstalled version of Apache, MAMP installs a separate version in a different location on your hard disk. This makes it easier to uninstall everything by simply dragging the MAMP folder to the trash if you decide you no longer want MAMP on your computer. MAMP also avoids conflicts with the preinstalled version of Apache by using a non-standard port (8888) to listen for requests for web pages.
To make it easier to deploy your PHP pages on the Internet, it's a good idea to configure MAMP to use the standard port for web servers (80). Instructions for how to do this are given later, but you should first check that the preinstalled version of Apache is not running.
Note: If you prefer to use the preinstalled version of PHP in Mac OS X 10.5, follow the tutorial on my website. Then skip to the instructions on how to install MySQL and phpMyAdmin separately.
To install MAMP on your Mac:

Figure 6. Installing MAMP from the disk image.
For the purposes of this article, you need to install only the free version of MAMP. The commercial version is an add-on that you can add later if you want to use its advanced features. To learn more about the commercial version, visit the MAMP PRO website.
To test and configure MAMP:

Figure 7. The MAMP control panel.

Figure 8. Changing the MAMP ports.
Click Set to default Apache and MySQL ports, as shown in Figure 8. The numbers change tothe standard ports: 80 for Apache and 3306 for MySQL. This will make your development with Dreamweaver easier.
Note: If, for any reason, you want to change back to the non-standard MAMP ports, open this panel and click Reset MAMP ports.
Click OK and enter your Mac password when prompted.
MAMP stops and restarts both servers.

Figure 9. PHP configuration information.
Congratulations! You have a working installation of PHP, MySQL, and phpMyAdmin. Although this screen might feel like information overload at this stage, it contains a wealth of information about your PHP setup. Return to this screen whenever you need to check details of the way PHP is configured.
Note: You can display the same information by creating a PHP file containing the following script and loading it into a browser:
<?php phpinfo(); ?>
Now that you have a PHP testing environment on your computer, you can skip to the section Define a PHP site in Dreamweaver so you can start developing, or return to Part 1 of the tutorial series Creating your first dynamic site in Dreamweaver (if that's where you started).