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

cgi-script error 505

Status
Not open for further replies.

optimised

Technical User
Jun 21, 2001
96
US
Hello,
Trying to run a form cgi-script that I downloaded from bnb.com I have not ran any other scripts yet on this server. When I run the script from browser It produces internal error. Log error says premature end headers
What causes this error? Is there something I need to edit in my httpd file?
I have created a sub directory like-
home/mydomain/ where cgi-bin is where I placed the script and perm is 755. I had to copy the cgi file to my /var/ directory though to avoid file not found error. I guess this is where apache is looking for the cgi-scripts.
Any suggestions what to try next?
 
Hi,

Well error 505 officially means "HTTP Version Not Supported" but that doesn't sound very likely in this case. Does the script depend on any perl modules that are not installed - e.g. CGI.pm ?

Try the following 'hello world' cgi-script as a very basic test... just make a /var/ with the following lines..

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

then do a 'chmod +x /var/ and test it out ..
Rgds
 
Hi,
The above still produces the error. I issued perl -c and perl -w ,both indicate the script is fine. I'm thinking it may be in my httpd file.

#
AccessFileName .htaccess
UseCanonicalName on
TypesConfig /etc/mime.types
DefaultType "text/plain"

ScriptAlias /cgi-bin/ "/var/#
ScriptAlias /cgi-bin/ "/var/#
<Directory &quot;/var/ AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

AddHandler cgi-script .cgi
# If the perl module is installed, this will be enabled.
<IfModule mod_perl.c>
Alias /perl/ /var/ <Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</IfModule>

<Directory &quot;/var/ SSLOptions +StdEnvVars
</Directory>

# Virtual hosts
# Virtual host Default Virtual Host
<VirtualHost _default_:*>
ServerName _default_
DirectoryIndex index.php index.html index.htm index.shtml
ServerSignature email
LogLevel warn
HostNameLookups off
</VirtualHost>


# Virtual host mydomain.com
<VirtualHost x.x.x.x>
DocumentRoot /home/mydomain/www/
ServerName ServerSignature email
</VirtualHost>

# Directories...
<Directory &quot;/&quot;>
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory &quot;/var/Options Indexes Includes FollowSymLinks
AllowOverride None
Allow from from all
Order Deny,Allow
</Directory>

<Directory &quot;/var/Options ExecCGI
AllowOverride None
Allow from from all
Order allow,deny
</Directory>
 
Hi,

Well apart from some repeated bits (<Directory &quot;/var/ again at bottom) it looks OK. Make sure that your perl is really at /usr/bin/perl as that can cause errors - you could also try the explicit +ExecCGI instead of ExecCGI in the cgi-bin directory block. Have a look at --> which describes how to set up apache for cgi.

Rgds
 
Still getting 505 error when trying to run Do I need to change my vhost container or add something else to my httpd file?

//
# Documents
DocumentRoot /var/UserDir public_html
IndexOptions FancyIndexing

#
ScriptAlias /cgi-bin/ &quot;/var/
#
<Directory &quot;/var/AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

AddHandler cgi-script .cgi

# If the perl module is installed, this will be enabled.
<IfModule mod_perl.c>
Alias /perl/ /var/<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</IfModule>

# Virtual host mydomain.com
<VirtualHost x.x.x.x>
DocumentRoot /home/mydomain/www/
ServerName ServerSignature email
</VirtualHost>
 
Hello,

Back on cgi problem this week. I noticed in the error_log
messages> error (2) file or directory not found ;
message> premature end of script next line in error_log.
I am sure the path and file exist.
If I run script from command line>
cgi-bin># perl myscript.cgi
it runs fine no errors. But in browser it can't find file or directory. What am I missing path seems to be correct.

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

Thanks
 
try
Code:
chmod 0755 myscript.cgi
and then try to access through the web...
AV
tnedor@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top