This article investigates the design and implementation of a scalable dynamic website using PHP as the deployment platform.
A N-tier architecture is proposed to facilitate scalability. Each tier is to be loosely coupled with the others allowing for the separation of functionality and administration. The article also investigates the use of Web Services and XML with PHP to realize such system.
An N-tier Architecture
Figure 1: A Scalable N-Tier Architecture
The design is based around the introduction of a Content Server. The Content Server provides a Web Service based interface over the Entities and Relations in the database. This separation allows the sites to retrieve/update the content without having to worry about the intricacies of SQL or the location of particular content. It also gives us an opportunity to provide features such as security and caching at a single place. Each site retrieves the data needed using the Content Server. The site would ship this XML data to the browser along with the reference to the XSL needed to present this in HTML. The browser would access the referred XSL (note: this XSL may itself be dynamically generated) and apply it to the XML to obtain the HTML page. For quicker response times the transformation may be done at the server side.