Gossamer Forum
Home : General : Perl Programming :

cgi file in htm form not running on local IIS server

Quote Reply
cgi file in htm form not running on local IIS server
Hi all,

I have no problem running a cgi script from a form on web host where the ACTION attribute is written either full URL or relative path, example
<FORM METHOD=post ACTION="http://www.webname.com/cgi-bin/message.cgi"> or <FORM METHOD=post ACTION="../cgi-bin/message.cgi"> etc etc.

but having a problem running on locally installed IIS server on my PC. IIS works just fine and the page can be accessed at http://localhost/index.html

If the cgi is located in C:/InetPub/wwwroot/cgi-bin/message.cgi, what should be the address to be written after ACTION ?

I tried putting in ike this <FORM METHOD=post ACTION="C:/InetPub/wwwroot/cgi-bin/message.cgi"> but failed to run the message.cgi file.
Quote Reply
Re: [matgos] cgi file in htm form not running on local IIS server In reply to
Hi,

Sounds more like a configuration error.

Make a test file, at: C:/InetPub/wwwroot/cgi-bin/test.cgi

...and then try that with this code:

Code:
#!C:/perl.exe
# change the above line to your path to perl on your machine!

print "Content-Type: text/html \n\n";
print "FOO";

Then, try running from your browser. If that fails, try renaming it to test.pl, and trying again.

If that still fails, make sure perl is setup right on your system.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] cgi file in htm form not running on local IIS server In reply to
if the perl file named test.pl is located in C such as C:/InetPub/wwwroot/cgi-bin/test.pl, what is the complete path or relative path to be typed in html tag

<FORM METHOD=post ACTION="???">
Quote Reply
Re: [matgos] cgi file in htm form not running on local IIS server In reply to
Hi,

It all depends on your server setup ;) Most liikely, http://localhost/cgi-bin/test.pl

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] cgi file in htm form not running on local IIS server In reply to
Hi Andy,

after changing the script file to format .pl, it now works for me. thanks.
Quote Reply
Re: [matgos] cgi file in htm form not running on local IIS server In reply to
Hi,

Glad to hear it :)

If you want .cgi to work, you could just add this in your main httpd.conf file:

Code:
AddHandler cgi-script .cgi

This should let the .cgi extension work too Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!