Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing CGI scripts on Apache

Status
Not open for further replies.

pisth

Programmer
Mar 18, 2003
43
US
Hell0,
When I was trying to execute cgi script on apache, I got the contents displayed instead of the file being executed.

Hence I added these lines in the httpd.conf file

<Directory /usr/local/apache/htdocs/somedir>
Options +ExecCGI
</Directory>
The above directive tells Apache to permit the execution of CGI files.
We will also need to tell the server what files are CGI files. The
following AddHandler directive tells the server to treat all files with
the cgi or pl extension as CGI programs:

AddHandler cgi-script cgi pl

However when I restart apache and try executing the cgi script...I get an error which says...

Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster
Error 403

How do I execute CGI Scripts using APACHE?. Is there any better way to do it?
How do I solve the problem?

Thanks!

Karthik.

 
Suggestions:

a)check that your script is executable (755)

b)add this line to your virtualhost container
ScriptAlias /cgi-bin/ /your/path-to/cgi-bin/

Blizz
 
hell0,
r u online now?..do u have msn?

they have executable permissions...n i did set the script alias too...doesnt seem to work?

my msn id is: kcisfine@hotmail.com

do u have msn?

karthik.
 
If you are using virtual hosts, if the owner of the directory and cgi file of the virtual host is a different user/group name from that of which apache runs under (nobody.nobody), that will create a problem. The way around this is to compile in suexec into apache. It took me a while to get this going at first so I can help you if needed.

In my situation, user webspace resided in there home directory. Each user space was owned by the user. That was necessary for ftp and email to work correctly for the user.

Since then, I no longer use cgi for users, as most applications can use databases now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top