|
|
Setting Up and Using CGI
|
|
|
|
Mac Elite
Join Date: Jan 2004
Location: Berkeley, CA
Status:
Offline
|
|
I need to execute CGI files on my localhost, and I've never done that before.
I read this article and tried to browse to localhost/cgi-bin/, but I don't have permission, and I don't know how to get permission. My account is an administrator account.
I also don't have permission to edit the httpd.conf file to try to adjust anything!
Please help! Thanks .
|
"Give me a lever long enough and a fulcrum on which to place it, and I shall move the world." -Archimedes
|
|
|
|
|
|
|
|
Senior User
Join Date: Jul 2004
Status:
Offline
|
|
1. This should be in web design were you would get better and more posts.
2. Even as an administrator you can't do everything. Places are locked to keep new users/admins out of stuff they dont need to touch which could cause something to go wrong. The way I edit my httpd.conf is I open it in text edit. When im done I save it to the desktop. Then more it to the httpd folder and it asks to over right and I do I replace and put in the admin password and its done. Restart apache (System Prefs -> sharing -> stop then start web sharing)
By Default your cgi files are put in /Library/WebServer/CGI-Executables
But you can change that in your httpd.conf this line:
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
and then change it to what ever you want or put a # in front of it to disable it and the directory stuff below it. then create a cgi-bin in your web root folder and It should work.
|
You shouldn't make fun of nerds... you'll be working for one some day.
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
I suggest learning a Unix text editor such as pico, emacs, or vi. Pico is the most simple of the lot, but also the least powerful. In your terminal, if you do a "sudo pico /etc/httpd/httpd.conf" you can authenticate to temporarily become the root user (that does have permission to edit this file), and make the changes you need.
What you need to do in your httpd.conf is set a ScriptAlias so that Apache knows which directory you want to be able to run executable CGI apps out of. Just make sure the following line is uncommented, and restart Apache if you need to:
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
Aside from that, as long as your web server is up, you have readable and executable permission to your CGI files in /Library/WebServer/CGI-Executables, you should be set.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
Forgot to add, you might need an AddHandler file in your httpd.conf to know how to handle files of certain file extensions. Simply uncomment this line and restart Apache:
AddHandler cgi-script .cgi
If your script has a .pl extension (Perl), create another line right below this that says this:
AddHandler cgi-script .pl
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Jan 2004
Location: Berkeley, CA
Status:
Offline
|
|
I have all of the following:
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi
Yet, when I go to http://localhost/cgi-bin/, I get:
You don't have permission to access /cgi-bin/ on this server.
What should I do?
|
"Give me a lever long enough and a fulcrum on which to place it, and I shall move the world." -Archimedes
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Jan 2004
Location: Berkeley, CA
Status:
Offline
|
|
I desperately need to install this, so any ideas would be great!
|
"Give me a lever long enough and a fulcrum on which to place it, and I shall move the world." -Archimedes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|