Feb. 17, 2011, 1:29 a.m.
posted by juff
If you’re hosting your own Web site, you have to get a Web server, install it, configure it, and keep it running. Choosing the UNIX Web server package that’s best for you is a question of finding the right set of features at the right price. (In the case of Apache, the right price happens to be free.)
Linux Most UNIX and Linux distributions include, for free, Web servers along with server software for other Internet resources, such as databases, e-mail, news, and FTP. Lots of Web servers are available, but the one most people use is Apache.
The Apache Web server is free and fast and popular. It runs on every UNIX you can think of, including Linux. (Versions for Windows are also available, but much less popular.) In fact, it’s the most popular Web server of any kind in use today (see the sidebar “Not too patchy” for details). If you’re on the Web, surf to the home page of the Apache HTTP Server Project, at www.apache.org, for information and downloads.
PHP is a programming language designed to be built into Web pages. Although it’s developed separately from Apache, PHP is designed to be easy to integrate with Apache, and most pre-configured versions of Apache include PHP. By putting little bits of PHP into a Web page, you can make minor customizations on the fly. For example, in our home page at http://net.gurus.com, the Reader Quote of the Day section uses some PHP code to insert the current day’s comment from a daily file so we don’t have to edit the Web page every night. Using a lot of PHP, you can write large, beautiful Web applications, as you see in the next section.
The other popular language people use for Web work is Perl, often described as the duct tape of the Internet. Although building bits of Perl into Web pages is possible, more commonly it’s used in CGI scripts, programs that run in a response to a request from a browser and build a Web page from scratch. As programming languages go, Perl is relatively easy to learn and use, although it’s still definitely a programming language. Perl For Dummies, 4th Edition, by our friend Paul Hoffman, tells you more.
Most sophisticated Web applications also need a database to hold the dynamic data for the site. Fortunately, UNIX has plenty of those available, too. The two most popular free ones are MySQL and PostgreSQL, both of which are packaged with most UNIX and Linux systems. They both work well; MySQL is faster while PostgreSQL has more complete data management abilities. If you need a really serious database, Oracle or IBM is happy to sell you all the database you need to run on your UNIX or Linux system.
Use someone else’s work, of course. A remarkably large amount of PHP and Perl code is available for free on the Internet, some of which is quite good. Drop by our sister site http://privacyfordummies.com, for example. We put in the beautiful graphics and sparkling and witty contents (well, one of our co-authors did), but all of the technical code that manages the articles, counts votes in polls, handles user registrations, and all of the other flashy features of the site come from a package with the odd name of Postnuke, an extremely powerful and flexible content management system written in PHP and MySQL and available for free at www.postnuke.com. You need to download Postnuke, or at least the parts of it you need, install it as a Web site on your server, and then start it up and configure it. A fair amount of work is involved, but it’s about 0.1 percent of the work of writing something like that from scratch.
If you look around, you can find everything from online calendars to blogging packages to shopping carts to online photo albums available for free in PHP or Perl. A good place to start looking is http://dmoz.org/Computers/Programming/Internet/Server_Side_Scripting.