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!

Configure apache for executing .cgi

Status
Not open for further replies.

optimised

Technical User
Jun 21, 2001
96
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 my domain's subdir cgi-bin folder
/home/mydomain/cgi
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

Works o.k from command line but error 500 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..
 
Possible reasons I can think of:

1. Your perl script may have not have the necessary execute permissions.

chmod +x test.cgi

from your UNIX prompt should help

2. Check if .cgi files are taken care of by Apache.



HTH



 
Hello,
test.cgi perm = 0755

Someone told me from another forum to try this command to remove any ^M from scripts which may be causing problem.


perl -e &quot;?????&quot; -i -n -p test.cgi

When I try it I get error executing -e compilation error

Any other way to do this?
thanks......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top