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

Executing Perl from HTML

Status
Not open for further replies.

sbhatta

IS-IT--Management
Jan 26, 2012
4
0
0
AU
Hello,

This is a basic question but I could not find any other post answering this and hence I am posting it.

I know that either of the following could be used to execute Perl script from HTML :

1. <!--#include virtual="/cgi-bin/test.pl" -->
2. <!--#exec cgi="/cgi-bin/test.pl" -->

My perl script is simple and it looks like this:
====
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "banana";
====

The HTML file looks like this:
=======
<html>
<body>
apple <br>
<!--#exec cgi="/cgi-bin/test.pl"-->
orange <br>
</body>
</html>
========

However, when the HTML file is rendered on a browser, it does not display the "banana" part.

The strange part is that when the perl script is run standalone on the browser using the following URL, it works:


My question is:

1. Do I need any Apache webserver settings to make this happen? What settings are they?
2. Does it need any perl module to be installed at the webserver to make this happen? What are they?
3. Are there any other issues that will make this run?

I have been struggling with this for quiet some time. Any help would be much appreciated.

Regards
Shantanu
 
sbhatta said:
I know that either of the following could be used to execute Perl script from HTML :

1. <!--#include virtual="/cgi-bin/test.pl" -->
2. <!--#exec cgi="/cgi-bin/test.pl" -->

How do you know this? What type of web server understands that #exec syntax? Are you sure it's supported by Apache?

This isn't really a question about perl, but more about the type of web server and the way it understands that syntax. Perhaps a post in the Apache forum may be more appropriate?

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
I got to know both the methods from various other forums which stated that they work. I just wanted to provide as much information as I could.
 
Try posting this question in forum65.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Two thing may be missing in your httpd.conf file
Server side includes must be enabled.
For the folder containing the file, make sure Options +Includes is specified

You may also want to specify additional file extensions to be filtered
AddOutputFilter INCLUDES .shtml

The following links will provide mroe info


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top