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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI execute problem. Win XP, don't have permission

Status
Not open for further replies.

ZsN1Gman

Programmer
Aug 22, 2002
17
US
Hello,

I can't for the life of me get CGI scripts to run. I have my sites all listed in c:\web\siteFiles

When trying to run a script like I get an error message: Forbidden "You don't have permission to access /siteFiles/cgi-bin/test.cgi

I can on the other hand read .txt files in the same directory, and if I name the script .pl the browser attemps to download it.

The error log says, "Options ExecCGI is off in this directory"

The following is from my httpd.conf

ScriptAlias /cgi-bin/ "C:/web/siteFiles/cgi-bin/"

The following <Directory &quot;C:/web/siteFiles/cgi-bin/&quot;> contains the defailt values. If I change Options to ExecCGI | +ExecCGI I get an internal server error, the error log then says, couldn't spawn child process.

I've tried everything I can see that governs CGI in the httpd. file.

I haven't had any throuble like this with with my IIS server.

If anyone has any hints I'd appreciate hearing them.

Jim
 
Hi Jim,

Did you ever fix this, I have the exact same problem.
File permissions first and then server error when I fill in the directory.
Cannot find an answer anywhere.

Regards
DD
 
You found the problem yourself, in your error log. You need to set directory permissions in your httpd.conf file as follows, right after the ScriptAlias:

<Directory &quot;C:/web/siteFiles/cgi-bin/&quot;>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

Also, make sure that the AddHandler is set:

AddHandler cgi-script .cgi .pl Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
It's been awhile since I had this problem.. But I think the portion(s) listed below fixed it. If this doesn't help I can send you my file for comparison.

...
# OLD ScriptAlias /cgi-bin/ &quot;C:/Program Files/Apache
# Group/Apache/cgi-bin/&quot;
ScriptAlias /cgi-bin/ &quot;/Wwwroot/[^\/]*/cgi-bin/&quot;

# &quot;C:/Program Files/Apache Group/Apache/cgi-bin&quot; should be
# changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.

<Directory ~ /Wwwroot/[^\/]*/cgi-bin/>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

# To use CGI scripts:
AddHandler cgi-script .cgi
...

The uncommented lines are of course the ones you might be interested in. I left the comments simply for reference.

&quot;/Wwwroot/[^\/]*/cgi-bin/&quot; - For clarification, my site files reside in &quot;C:\ The way this is written allows you to execute scripts from any cgi-bin on the server.

The other thing is, if your getting the &quot;couldn't spawn child process&quot; error. More than likely Apache can't find your perl interpreter. If the shebang line in your script is something like /usr/bin/perl, you might need to be a little more specific. Assuming you’re on a windows system try something like c:/usr/bin/perl (your path of course). Apache can also get your interpreter location from the registry by uncomment the &quot;ScriptInterpreterSource registry&quot; in your httpd.config file - But unfortunately this doesn't work for me.

Hope this helps, Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top