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

CGI - APACHE CONFIG

Status
Not open for further replies.

optimised

Technical User
Jun 21, 2001
96
0
0
US
Hi folks,

I am trying to get my web server to execute cgi-scripts. I'm starting off using this small script listed below. I put the script in the /var/ directory and in my domain's cgi-bin folder because I would like to allow virtualhost it's own cgi-bin.

#!/usr/bin/perl
#
print "Content-type: text/html\n\n";
print "Hello World\n";

I ran >perl -c test.cgi
syntax fine
Then >perl - w test.cgi
Hello World

command line works fine returns- Hello World.
/cgi-bin>#perl test.cgi

Why can't apache execute cgi-script from directory of
/home/mydomain/cgi-bin

Works o.k from command line but error from browser
//
[error] (2) No such file or directory: exec of /home/mydomain/cgi-bin/test.cgi
[error] Premature end of script headers

//httpd file

ScriptAlias /cgi-bin/ "/home/mydomain/cgi-bin/"

<Directory &quot;/home/mydomain/Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory &quot;/home/mydomain/cgi-bin&quot;>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<VirtualHost x.x.x.x>
DocumentRoot /home/mydomain/www
ServerName ScriptAlias /cgi-bin/ &quot;/home/mydomain/cgi-bin/&quot;
ServerSignature email
</VirtualHost>


Thks for help..
 
If you don't get the answer you need here, check out the perl forum. There's some people there who are good at explaining how to set up apache. There may even be a FAQ on it there. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I think you may need to add the 'ExecCGI' to your options section for that directory.

ScriptAlias /cgi-bin/ &quot;/home/mydomain/cgi-bin/&quot;

<Directory &quot;/home/mydomain/cgi-bin/&quot;>
Options [red]ExecCGI[/red]
AllowOverride None
Order allow,deny
Allow from all
</Directory>



I think that is all you should need.
HTH Please use descriptive titles and check the FAQs.
And, beware the evil typo.
 
Hi,

I tried Options ExecCGI with no success
running rh7.1 if it matters

Same error in httpd error log

[error] (2) No such file or directory: exec of /home/mydomain/cgi-bin/test.cgi
[error] Premature end of script headers

Thks
 
Hello,

Since I cannot resolve the problem of why I cannot get cgi-scripts to run from browser, is there any way to test that perl is operating correctly?
Don't know what else to try..
thanks........
 
Hi,

Is it not something to do with the trailing slash on the directory.

On the example above you have the scriptalias with a trailing slash and the directory doesn`t. I am sure both have to be identical for the server to understand that the directories are the same.

Hope this helps
Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top