Macworld Forums: CGI in OS X with Apache - Macworld Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CGI in OS X with Apache

#1 User is offline   schokid02 Icon

  • Veteran
  • PipPipPip
  • Group: Members
  • Posts: 1,323
  • Joined: 28-June 02

Posted 21 November 2003 - 01:59 PM

I am currently hosting my own web page and would like to add mailforms, guestbooks, etc. using CGI-scripts. I found a great site (www.webteacher.com) to learn how to write the CGIs, but I haven't found anyplace that explains very well how to enable CGI with Apache. I'm running OS X 10.2.6 (plan to upgrade to Panther soon). I haven't touched any of the default Apache/Web Server stuff, except to enable personal web sharing. Does anyone know how to enable CGI with Apache? I've gotall my webpage stuff in my user/Sites folder and would like to store all my CGI stuff in the same place (possibly in a new folder user/Sites/cgi-bin/ ). How can I get all this to work nicely? Thanks.
0

#2 User is offline   Dr-NiKoN Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 741
  • Joined: 20-May 01

Posted 24 November 2003 - 12:24 AM

By default CGI is enabled site-wide trough http://webserver/CGI-Executables/ or more popularly aliased to http://webserver/cgi-bin
If you want to enable this together with the UserDir-module, you will have to edit httpd.conf though.
First of all, you need to permit CGI execution to each directory:
code:

<Directory /Library/WebServer/foo/bar>
Options +ExecCGI
</Directory>


You can now run CGI-scripts from http://webserver/foo/bar
This does require that you allready are handling CGI-files with the AddHandler directive, Apache on OS X does this by default.
To enable this for each user, you would do something like:
code:

<Directory /Users/*/Sites/cgi-bin>
Options ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>


May I suggest that you read httpd.conf and try to learn and understand how it works. It's not really that hard, it just requires some work and research. You might also notice that the is allready a similar configuration for Users in httpd.conf, it's up to you how you want to do this.
nikon
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

3 User(s) are reading this topic
0 members, 3 guests, 0 anonymous users