View Single Post
Old 03-18-2007, 02:13 AM   #5 (permalink)
misho
New Member
 
Join Date: Mar 2007
Posts: 11
Default

Alright, in case anyone is running Apache, this is how you enable running CGI scripts anywhere you want to (this is for apache-2.0.54, so it might be somewhat different for the 2.2 releases):

1. find httpd.conf which might be in /etc/apache/something or something else under Windows. Searching for the file should be easy enough, how many files called httpd.conf could you possibly have?

2. open httpd.conf in a text editor.

3. find a line that says something like: Options Indexes FollowSymLinks
This should be inside the <Directory "/path/to/webroot/htdocs"> section. This is important, since pretty much any <directory "/p/a/t/h/"> section could have such a line.
Append ExecCGI to the line: Options Indexes FollowSymLinks ExecCGI
NOTE: Windows probably won't have a FollowSymLinks option, since there are no symlinks in Windows.

4. Find a line that says something like: DirectoryIndex index.html
This line should be outside all sections (i.e. not between <something> and </something>). It tells the webserver to automatically open index.html when you navigate to a directory. So, when you go to www.foo.com, it will open www.foo.com/index.html.
Append index.cgi (or whatever you want as long as it ends in .cgi) to that line: DirectoryIndex index.html index.cgi
Now, it will look for index.html and index.cgi.

5. Now, add a line (outside all sections) that says: AddHandler cgi-script .cgi
Chances are that there is already such a line but it has been commented out. Try searching for it and removing the # from the beginning of the line.
This line tells Apache that when it comes across a file that ends in .cgi, it should execute it rather than displaying its contents.

Now, restart apache and make an index.cgi file in some directory and try to open it
__________________
- Misho
misho is offline   Reply With Quote