Developing something as complex as a server model is an extremely difficult task; it consumes a phenomenal amount of time, and resources. The prime reason for creating a server model for Dreamweaver is to easily create database interactions within your web site. For the other server models, this process was simplified as they all follow unitary methods for connecting to a database and retrieving information.
Unfortunately, PHP has a number of different standards for connecting to a database, and each of these utilizes a different set of commands. At present PHP supports at least nineteen different Database Management Systems (DBMS), all of which use a different set of commands to achieve the same task. Integrating support for nineteen different databases of course causes a number of logistical problems, as every tool that uses a database connection of some form would need to have nineteen variants.
Thankfully, there was a very simple solution. It is very common practice with web site host providers who provide PHP support, to include support for only one of these databases, MySQL. It therefore made sense for only that database system to be directly supported within Dreamweaver MX, and it is the DBMS we will be using for this book.
The PHP server model in Dreamweaver MX is very much a skeleton framework. If you compare the feature sets of the other integrated scripting languages, it is clear that PHP hasn't been given the same level of functionality as the other server models. This might appear a little disappointing at first, but due to the popularity of this scripting language, and the extensibility of Dreamweaver itself, it is only a matter of time before extension developers produce more tools to enhance your PHP experience.
Don't be fooled by the fewer number of tools. Everything that can be achieved with the other server model tools can also be achieved with the PHP server model, excepting Login Security, which at the time of writing wasn't present in Dreamweaver MX, and according to Macromedia sources, won't be in the final product either. However, we will be covering how to create a login system in Chapter 9.
The Development Environment
Before you can begin developing PHP pages, it is important to establish how you will test those pages. It is common for developers to have some form of test server, with which they can experiment before publishing their pages to the wired world. Over the next few pages, we will look at setting up PHP to run on your web server.
The most important thing to begin with, is to obtain a copy of PHP from the PHP web site (http://www.php.net/downloads). Here you will find a number of different versions of PHP, and this can become a little confusing, as it is well supported on a wide variety of platforms and web servers. For the purposes of working through this book, and for working with Dreamweaver MX, you should download the PHP 4.x version that is appropriate for your operating system.
The two most common flavors of PHP are for Windows and for Linux. The chances are that you are using a web server that is installed on one of these two platforms. For the purposes of this book we will assume that this is the case. However, if you find that your web server actually runs on a different platform from the above, you will find detailed and accurate information about how to install PHP in the downloadable archive for your platform.
It won't be long before you also notice that there are binary distributions and source distributions, and you'll probably wonder at the difference. Source distributions are versions of PHP's sourcecode, the actual C language code that makes PHP work. When working with a sourcecode distribution like this, you first have to use the right tools to compile the sourcecode to work on your chosen system. The compile process turns the sourcecode into an executable file and a series of libraries. Compiling code can be a complex task, but, if you have a web server that is hosted on a Linux machine, then it is actually rather simple, as all of the tools that you will need are installed by default. Unfortunately, these tools aren't included at all with a Windows installation, so it is recommended that you download the binary distribution in Zip format for Windows web servers. If you are using Linux on your development server, then it is recommended that you download the source distribution, or if you are using a flavor of Linux that uses the Red Hat Package Manager (RPM), you should find the appropriate files in your distribution's CD under the RPMS directory.
One important note should be made here, for the benefit of Macintosh developers who are using OSX. OSX is based on Darwin, which, like Linux, is a UNIX-like operating system. Because of these similarities many of the configuration options for Linux will also apply to OSX. Thankfully, those of you running OSX 10.1 or above will already have PHP installed by default, as it is now included in the default installation. There are a number of additional features of PHP that are disabled in the version of PHP distributed with OSX, however for the majority of tasks, and certainly for the ability to develop PHP pages using Dreamweaver MX, you can safely rely on the version you already have.
PHP-Compatible Web Servers
As previously mentioned, PHP will work on a number of different platforms and web servers. We have already talked about Windows and Linux versions of PHP, but what web server does PHP need in order to work?
PHP will actually work with the vast majority of web servers available, including Apache and Microsoft's Internet Information Server (IIS), both of which are the most common web servers in use today. If you find that you are using another web server, such as Xitami or a Netscape-based web server, you can find full instructions on how to configure these within the install.txt file included in your PHP download. Here we will concentrate on installing and configuring PHP on Apache and IIS.