n the history of the Internet there have been few technology combinations as compelling as 'LAMP' has proved to beLinux, Apache, MySQL, and PHP. They are the cornerstone of low cost, data-driven Web sites. Linux, the open source operating system on which server class applications can run; Apache, the most popular Web server in the world; MySQL, an extremely popular open source database; and PHP, a server-side scripting language used to build data-driven Web sites.
To the uninitiated, setting up a Web server, database, scripting language, and operating system isn't totally straightforward and there is a large learning curve to ascend before productivity can result. It can be particularly difficult for Microsoft specialists, whose familiarity with Windows and associated technologies such as IIS, SQL Server, and ASP can get in the way of learning things the LAMP way. That is, until now.
Thanks to the Uniform Server project, an open source initiative designed to be a one-stop-shop for administration of Apache, MySQL, and PHP, it is now embarrassingly easy to set up a data-driven Web site. The only caveat with Uniform Server is that it is not a LAMP project, but a "WAMP" projectnamely, it is designed and tested for Windows. You can use this to build and run your site on your Windows PC at home and seamlessly install it to run on a public Web site hosted by an ISP when you are ready. That way you don't need to set up and install your own Linux system complete with Apache, MySQL, and PHP, which can be a difficult prospect for the uninitiated, yet you still reap the benefits of developing Web sites that run on this environment.
In this article you will learn how to install the Uniform Server, and use it to build your first MySQL + PHP Web applicationyour very own blogging site!
Uniform Serveralso known as the 'mini' server, because of its size and lack of complexityis a small download, less than 4MB, and requires no installation at all. It doesn't touch your registry in any way. Simply download it, unzip it to your directory of choice, and execute the start.bat command file.
|Figure 1. The Uniform Server Main Screen: Unpack the download and run start.bat to reach the menu page for the Uniform Server.|
One thing to note here is that this will start the Apache Web server, which can conflict with IIS should you have it installed and running. The Uniform Server is perfect for Windows XP Home Edition, which doesn't come with IIS, but should the Microsoft Web server be running you will need to stop it to use the Apache implementation that comes with Uniform Server. You can do this using the Internet Information Services applet in the Administrative tools area of Control panel. Simply select the 'Default Web Site' element, right click it, and select 'Stop'.
From a command prompt, run start.bat and you will then be able to access the Web server's administration screen at http://localhost/a/ (see Figure 1).
From this screen you can control everything on your Web server. It is important to note that the Uniform Server creates a RAM disk with a virtual drive, with the drive letter 'W'. Inspecting this drive you will see the following directories:
Using the Uniform Server to Build a Blog Site
- WWWThis is where you put your Web pages. Later in this article, I will look more closely at how to use the Uniform Server to build a simple blogging site.
- CGI-BINIf you want to use PERL, your scripts go in here.
- HOMEThe administration screens and scripts are stored here.
- USRThis is where the engines for running PHP, PERL, and MySQL are stored.
- TMPTMP is a directory for temporary files.
Blogging is all the rage at the moment, and the fact that building a blog site is deceptively easy has probably helped the popularity of blogging along. For the rest of this article you will step through how to build one using MySQL as the database storing your blogs and HTML and PHP running on the Uniform Server installation of Apache to save and read entries.
A simple blog works by having three Web pages and a database that backs them up. The first Web page is an HTML form that you use to make your entry. This form allows you to type your bloggings, select a category in which they will reside, and finally authenticate yourself so that the blog will only accept entries from you. The authentication scheme that you will use here is a simple PIN number, but you could easily expand on this, if you want to make more secure sites using alphanumeric passwords or SSL. The categorization allows you to separate entries into designations such as work, school, movies, music, or any type of categories you prefer.
The second page is a PHP script that accepts this form submission, authenticates you, creates a new database entry with the blog details, and categorizes it.
The third page is the one that blog visitors would see; it is a PHP script that reads the latest entries from the blog, and formats them into HTML for return to the browser.