Hi

 

I’m trying to execute a simple Perl and/or Python script on Apache2.2 from within an HTML document, but with no success.

 

Please advise if this is the incorrect list to address this problem to.

 

I have a simple “Hello, World!” script in Perl that I want to execute from within an HTML page. The script is located in the Apache/cgi-bin/ directory. I can execute the script via my browser by simply entering it’s URL and sure enough the browser window displays “Hello, World!”.

 

However, if I then create a very simple HTML page with an execute in it I only get the HTML page and text displayed. The HTML doc is located in a directory on the C:/ drive and not in the Apache/htdocs/ directory.

 

The method used to execute is: “<!--exec cgi=”/cgi-bin/test.cgi” -->” I think I have the white-spaces/syntax correct.

 

My Apache conf file has ExecCGI in the Options directive for the Apache/cgi-bin/ directory.

 

I am at a loss as to why the script appears not to be executed – is it being executed and perhaps not doing what I think? At the moment I simply want to be able to prove that I can run a script from within HTML and output text back to the document which is then displayed within the browser. This is not related to forms in anyway.

 

As I said, the script executes fine if I call it direct (as does the printenv.pl/.cgi script), so I’m sure that is okay & has the right header info – I don’t have to compile it or something first do I?!

 

(n.b. the script below is in Python, not Perl, but they are very similar apart from the executable and display exactly the same symptoms.)

 

Any help greatly appreciated!

Simon.

 

[HTML] located at: Z:\IRISIndex\test.html

<html>

 <head>

  <title>CGI Test</title>

 </head>

 <body>

 Test

 <!--#exec cgi="/cgi-bin/test.cgi" -->

 </body>

</html>

 

[CGI] located at: Z:\Program Files\Apache Group\Apache2\cgi-bin\test.cgi

#!c:\python23\python.exe

# -*- coding: iso8859-1 -*-

#  test -- test CGI program to display a simple message

 

# Required header that tells the browser how to render the text.

print "Content-Type: text/plain\n\n"

 

# Print a simple message to the display window.

print "Hello, World!\n"

Reply via email to