A simple CGI question

Anthony Atkielski atkielski.anthony at wanadoo.fr
Tue Jan 25 01:28:24 PST 2005


Gareth Bailey writes:

GB> If a cgi script is in my /usr/local/www/cgi-bin directory, what url
GB> would i use to access the cgi from the web. Would i need to copy the
GB> cgi into my data directory? - i tried this and the browser treated it
GB> as a download.

It all depends on how you have Apache configured, but a typical
configuration would require that you reference the CGI script with
something like

http://www.yourdomain.com/cgi-bin/mycgiprog.pl

The extension on mycgiprog depends on what form the CGI takes; .pl is
for Perl programs.  Your Apache server has to be configured to either
treat all files in a certain directory (usually cgi-bin) as executable
programs, or to recognize certain extensions as executable programs, or
both.

Note that there are many security issues with providing something as
sensitive as a password-changing program on your Web server, so take
great care in your implementation.  (And remember that Apache normally
does not execute as root, so it cannot change passwords in executable
CGI programs without special configuration.)

-- 
Anthony




More information about the freebsd-questions mailing list