Chapter 8. Dynamic Content
Very few Web sites can survive without some mechanism for providing dynamic content—content that is generated in response to the needs of the user. The recipes in this chapter guide you through enabling various mechanisms to produce this dynamic content and help you troubleshoot possible problems that may occur.
CGI programs are one of the simplest ways to provide dynamic content for your Web site. They tend to be easy to write because you can write them in any language. Thus, you don’t have to learn a new language to write CGI programs. Examples in this chapter will be given in a variety of languages, but it’s not necessary that you know these languages in order to see how to configure Apache for their execution.
Although CGI is no longer the preferred mechanism for generating dynamic content, it is the simplest, and understanding how CGI works is a great help in understanding how the more complex dynamic content providers work.
Other dynamic content providers, such as PHP and mod_perl, also enjoy a great deal of popularity, because they provide many of the same functions as CGI programs but typically execute faster.
8.1. Enabling a CGI Directory
You want to designate a directory that contains only CGI scripts.
Add the following to your httpd.conf file:
ScriptAlias /cgi-bin/ /www/cgi-bin/
A CGI directory will usually be designated and enabled in your default configuration file when you install Apache. However, if you want to add additional ...