Introduction
A growing number of webmasters are finding that the effort to manually manage content becomes greater as a website grows until, eventually, the site is practically unmanageable. Old content must be moved into archives, pages must be formatted, and news posters given access to upload and/or edit content. A Content Management System (CMS) can solve all of these problems. Many of the best CMS solutions are based on the PHP language, the Apache web server and the MySQL database engine. As all of these items are "Open Source" software, these cost to acquire a development system is low, and the number of freely available software building blocks to help you get started is high. While this is by no means the only thing one can do with PHP, it is clearly one of the most popular categories of PHP development on the Web.
What PHP is.. and isn't
PHP is a scripting language, not an an application server. As a poster named tweakt describes it on Slashdot, "In PHP, all you have are scripts. Sure they may be optimized, compiled, pseudo-object-oriented and even obfuscated… but they are still scripts. They may even include each other. But they are still scripts. After executing, they forget all knowledge. There is no persistence, no threading, no transactional support."
He adds: "For very simple things, that don’t need to scale, both in usage, and codebase, then PHP is ok. But for designing real web applications, which need to be managed by more than a few developers, integrate with legacy systems, implement a full three tier architecture, etc., PHP just doesn’t cut it."
Other users assert that the real comparison is against [Macromedia's] Cold Fusion.
Hello, PAM
Some users call the combination of PHP, Apache and MySQL "PAM" and have moved from proprietary development environments to a PAM platform, drawing from the vast number of free resources that Open Source software programmers freely share.
It is possible to set up and run a PAM environment on Windows, Mac OS X, Linux, BSD Unix, and other common platforms.
MySQL is becoming a powerful and widely used alternative to commercial database engines such as Microsoft's SQL server. At the first-ever MySQL user conference in April 2003, the Swedish company that develops open-source database software said more than 29,000 people are downloading MySQL each day, and it has more than 4 million users worldwide.
Getting Started
Indeed, almost any platform can support the necessary software to set up and run a database-driven website. Most Linux distributions include all the necessary components. Windows users can download versions of the Apache webserver, PHP and MySQL and Mac fans can use Mac OS X's built-in Apache webserver, PHP and MySQL for that platform. Other BSD- and Unix-based systems have similar requirements.
There are a number of freely available, ready-made scripts that can be used to simply the development of a database-driven website. Many users consider PHP Nuke (www.php-nuke.org) one of the best -- although those in the community consider it somewhat "on the outs" due to growing developer discontent over the far more "open" development environment of some of its competitors, chiefly PostNuke.
There are a number of useful add-ons and modules available for PHP Nuke. See the following sites for some examples:
PostNuke adds even more functionality, as do several other "Nuke" variants: Scoop, MyPHPNuke, PHPWebSite, etc. The current version of PostNuke is still incomplete, but it shows significant promise and, when fully mature, looks likely to be even better -- and significantly more secure -- than its predecessor. There are many other CMS systems, including (but my no means limited to) Movable Type, Greymatter and Slash, to name just a few.
SQL Issues
A common problem with these and other MySQL-based solutions (or those based on Microsoft's SQL Server, for that matter) is their tendency to be very taxing on the system and, in some cases, the internet connection to which it is connected. The author of "boycottxp.com" (no longer active, the domain has since turned into a generic advertising portal site) in May 2002 posted a message summarizing his situation. "We're working on a new solution that doesn't abuse MySQL as much as the Scoop engine did. We're probably going to use Post-Nuke."
Similar problems are common among SQL-based websites. Neowin.net, based on MySQL and PHP 4.1.2, shut down completely for a period in Aug. 2002, citing an unacceptable number of "Connection Failed: Too many connections..." errors. Elsewhere, "MySQL Connection Failed: Too many connections in /usr/local/www/..." messages appear with alarming regularity on almost any PHP-based site carrying hot news stories.
Fortunately, there are things you can do. Microsoft's documentation for SQL Server recommends running it on a different computer than the one serving the web pages. This also applies to MySQL. Even when this is done, lag times can be significant. Stress-testing under heavy loads is really the only way to determine if your system is up to the challenge.
Another fairly common scenario plaguing many MySQL-based new servers and "chat board" websites seems to be database corruption. Although there are many reasons why data corruption can occur (hard drive defects, program errors, system crashes, etc.), such crashes frequently cause massive data loss on database driven sites, where it is not just one document that is lost in a worst-case scenario, but the whole database. A regular backup regimen is recommended. But you already knew that, right?
Security Caveats
It's also worth mentioning that there is always the potential for security problems with these or, indeed, almost any internet-accessible systems. Some versions of the PHP scripting language itself contain vulnerabilities (see our Security Alerts page for details), and the CMS systems or the foundations upon which they are built may introduce weaknesses to an otherwise reasonably secure system. A worm designed to seek out and attack Microsoft SQL Servers configured without a password began spreading quickly in May 2002. (Serves 'em right, I say.) As is the case with most Open Source software, such holes are usually noticed and patched quickly, but it's often prudent to avoid the "bleeding edge," where bugs are most likely to bite.
For Further Reading:
Resources:
Open system PHP CMS apps:
Post new comment