Components of a PHP Application

In order to process and develop dynamic web pages, you'll need to use and understand several technologies. There are three main components to creating dynamic web pages: a web server, a server-side programming language, and a database.

It's a good idea to have an understanding of the three basic components for web development using PHP. Start with some rudimentary understanding of the history and purpose of Apache (your web server), PHP (your server-side programming language), and MySQL (your database).

This can help you understand how they fit into the web development picture. Remember that dynamic web pages pull information from several sources simultaneously, including Apache, PHP, MySQL, and Cascading Style Sheets (CSS).

PHP is ubiquitous and compatible with all major operating systems. It is also easy to learn, making it an ideal tool for web-programming beginners. Additionally, you get to take advantage of a community's effort to make web development easier for everyone.

The creators of PHP developed an infrastructure that allows experienced C programmers to extend PHP's abilities. As a result, PHP now integrates with advanced technologies like XML, XSL, and Microsoft's COM. At this juncture, PHP 5.0 is being used.

Apache is a web server that turns browser requests into resulting web pages and knows how to process PHP code. PHP is only a programming language, so without the power of a web server like Apache behind it, there would be no way for web users to reach your pages that contain the PHP language code.

Apache is not the only web server available. Another popular web server is Microsoft's Internet Information Services (IIS), which is supplied with Windows 2000 and all later versions.

For the most part, the differences between Apache and IIS come down to personal preference, although Apache has the decided advantages of being free, providing full source code, and using an unrestricted license.

Apache 2.0 is the current version you'll be using. IIS is easier to integrate with Active Directory, Microsoft's latest authentication system, but this applies mostly to internal company web sites. Because web servers like Apache and IIS are made to serve up pages from HTML files, they need a way to know how to process PHP language code.

Apache uses a system called modules to load extensions into its functionality. IIS uses a similar concept called ISAPI. These both allow for faster processing of the PHP code than the old school process of calling PHP as a separate executable each time the web server had a request for a page containing PHP.

Apache has only two major versions in use today. They are 1.3 and 2. Apache 2 is a major rewrite and supports threading. Threads are a way for a single process to manage more than one thing at a time. The benefit is an increase in speed and a reduction in the resources needed.

Unfortunately, PHP isn't totally compatible with threading yet. Apache 2 has been out long enough to be considered stable for development and production use. Apache 2 also supports more powerful modules. Some additional modules can be found at www.cri.ensmp.fr.

However, shared module DLLs that don't come with the official Apache source files, such as mod_php4, mod_ssl, mod_auth_mysql, and mod_auth_ntsec, can be found on the Web.

MySQL was developed in the 1990s to fill the ever-growing need for computers to manage information intelligently. The original core MySQL developers were trying to solve their needs for a database by using mSQL, a small and simple database.

It become clear that mSQL couldn't solve all the problems they wanted it to, so they created a more robust database that turned into MySQL MySQL supports several different database engines.

The database engine determines how MySQL handles the actual storage and querying of the data. Because of that, each storage engine has its own set of abilities and strengths. Over time, the database engines available are becoming more advanced and faster.

The current production release of MySQL is the latest available 5.0x version. MySQL 5.0 provides performance that is comparable to any of the much more expensive enterprise databases such as Oracle, Informix, DB2 (IBM), and SQL Server (Microsoft).

The developers have achieved this level of performance by leveraging the talents of many open source developers, along with community testing. For general web-driven database tasks, the default MyISAM database engine works perfectly fine.

Apache also has the advantage of being able to run on operating systems other than Windows, which now brings us to the subject of compatibility.

Web browsers like Firefox, Netscape, and Internet Explorer are made to process HTML, so it doesn't matter what operating system a web server runs on. Apache, PHP, and MySQL support a wide range of operating systems, so you aren't restricted to a specific OS on either the server or the client.

While you don't have to worry much about software compatibility, the sheer variety of file formats and different languages that all come together does take some getting used to.