Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI script execution

Nto able to execute CGI scripts

         

sudhir shet1

6:45 am on Sep 23, 2005 (gmt 0)



When I call a CGI script from a HTML form, the CGI code is printed on the html page. But the CGI perl code is not executed.

HTML Page:
<html>
<title>Testbed Usage</title>
<form action="env.cgi" method=post>
<input type="button" value="ADD" name="B3"></input>
<body>

env.cgi:

use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print header;
print start_html("Environment");
print "test\n";
print end_html;

On clicking the ADD button, the above mentioned cgi code is displayed.
Could you please help in this regard?

Mike12345

8:24 am on Sep 23, 2005 (gmt 0)

10+ Year Member



Are you saying that it just prints the contents of the cgi file? If so then cgi scripts are not executable in the directroy you have it in. Most hosting accounts only allow cgi's to be executed in /cgi-bin/, contact your host for more details.

If this is not the case then please provide more details of your problem, error code etc.

sudhir shet1

9:11 am on Sep 23, 2005 (gmt 0)



Yeah, it is just printing the contents of the cgi file. Also please note that i have not published these files on any web server. Is this necessary?
I am just trying these out on Windows 2000 environment. Will it work as it is?

mikeyb

9:20 am on Sep 23, 2005 (gmt 0)

10+ Year Member



Hi,

It is possible to test your scripts out before uploading to a web server.

You will need a local web server running on your pc (IIS is included with Windows 2000)
And you will also need perl installed, for windows use ActivePerl from Active State.

Also cgi scripts can (usually) only be run from one directory on your server, usuall cgi-bin

sudhir shet1

10:23 am on Sep 23, 2005 (gmt 0)



How should i place these files on my webserver?
I mean should i create a cgi-bin directory in the wwwroot and put .cgi file there?
Please guide..

Thanks..

sudhir shet1

8:33 am on Sep 24, 2005 (gmt 0)



Now if i call the cgi script, it gives the following error:

The page cannot be displayed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
--------------------------------------------------------------------------------

Please try the following:

Contact the Web site administrator if you believe that this request should be allowed.
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
HTTP Error 405 - The HTTP verb used to access this page is not allowed.
Internet Information Services (IIS)

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the words HTTP and 405.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Setting Application Mappings, Securing Your Site with Web Site Permissions, and About Custom Error Messages.