Where to Put CGI Programs
Can we put our CGI programs(scripts) to any directory to make it run?
Obviously the answer is "no". Before you write your own CGI programs, you'd
better make sure whether you have permission to execute CGI scripts. Otherwise
you are just wasting your time.
Most often we see people place their CGI program in server's cgi-bin
directory. When you want to use your own CGI programs, you must first ask the
web master to put your CGI programs in the cgi-bin directory. But this is
not the only way.
Usually, the web server controls access to directories or files through
Access Configuration file. Different server have different way to implement it.
For example, for Apache webserver and NCSA httpd server, there are two methods
for controlling access to directories:
- Global Access Configuration File
A document in server's conf directory, by default is
access.conf, which controls access to any directory in your tree. For
example, we can give the cgi-bin directory permission to execuate CGI
program, of course we can give other directory the same permission in server's
home directory. But this is not recommended for security reason. This is why
cgi-bin is the most common way. This can be only defined by the web
master or system administrater.
- Per-directory Access Configuration File
The default file is .htaccess, which control access to directory and
its sub-directory. This can be define by the common user. But this can be
restricted or completely forbidden by the Global ACF. So Now we
can see that there's two ways to place your CGI programs:
But anyway, before start writting your own CGI program,
come to see your web master first!
|