cgi/perl - html problem...

catocom

Well-Known Member
I'm trying to make a cgi- footer for my web pages.
The code looks like this, and works.
Code:
#!/perl/bin/perl.exe 
###############
# Footer
#
##put this on page you want footer to appear <!--#exec cgi="footer.cgi"-->
###############

$footer_file = "footer.html";

print "Content-type: text/html\n\n";
open(FILE,"$footer_file");
while(<FILE>) {
   print $_;
}
exit;

you can see it in action here...
http://66.168.192.248/cgi-bin/footer.pl

The problem...
I can't get it to showup in my html page...

http://66.168.192.248/G.html

Code:
 <HTML>

<HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- CREATION DATE: 2/17/2004 -->

<meta http-equiv="Content-Language" content="en-us">
<TITLE>Thread Wonders</TITLE>
<META NAME="Author" CONTENT="John Scott Cato">
<META NAME="Generator" CONTENT="AceHTML">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<meta http-equiv="imagetoolbar" content="no">
<link REL=SHORTCUT ICON href="images/Tw.ico">

</HEAD>

<body bgcolor="#FFFFFF">               
<center>

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

</center>
</body>               
</html>

Anybody here have any fix suggestions?
 
*not a perl nor cgi guy*

Copy the html page and print it with perl.

Just a thought.
 
well I don't want the whole page.
What I'm trying to accomplish is putting a call for the
script that will put the same footer on every page I put the
little footer code in.
That way, every time I add a page to my site, I don't have
to go back and put a link to it on every other page.
 
why don't make the whole site in perl??
instead of using html and perl, use just perl and the html code just print it. Something like this:

Code:
print "<HTML>

<HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- CREATION DATE: 2/17/2004 -->

<meta http-equiv="Content-Language" content="en-us">
<TITLE>Thread Wonders</TITLE>
<META NAME="Author" CONTENT="John Scott Cato">
<META NAME="Generator" CONTENT="AceHTML">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<meta http-equiv="imagetoolbar" content="no">
<link REL=SHORTCUT ICON href="images/Tw.ico">

</HEAD>

<body bgcolor="#FFFFFF">               
<center>"

call_to footer.pl

print"</center>
</body>               
</html>"

Now just replace the call_to with the appropiate perl function to exec another file and add the escape sequences.

It is just a thought, i'm sure there's a way to do it the way you are doing it, but i just don't know.
 
put it in a pl file, and add the #!/perl/bin/perl.exe

you will need to add the escape sequences for the symbols inside the quotes of print.
 
wouldn't I have to make all my pages like that then,
and then that wouldn't defeat the perpose, wouldn't it?
 
yeah, that's the bad thing about the suggestion i gave.

OK, i took a look at the code again (G.html you posted), and i noticed that you are calling to "/cgi-bin/footer.pl", you might want to try "cgi-bin/footer.pl" instead, that could be the problem since /cgi-bin/ means cgi-bin is in the root directory while cgi-bin/ means a relative path. Just a thought again.
 
I figure it's probably a path/permision problem of some kind too, but
I'm not sure.
I've tried...
<!--#exec cgi="/cgi-bin/footer.pl"-->
<!--#exec cgi="cgi-bin/footer.pl"-->
<!--#exec cgi="/footer.pl"-->
<!--#exec cgi="footer.pl"-->
and
<!--#exec cgi="http://66.168.192.248/cgi-bin/footer.pl"-->
:confused:

It's getting to the point where I'm going to
have to just get away from it at least until tomarr---er um later today (notes time)

It took me 3 days just to get the perl installed, and working somewhat. :sick3:
Well, that's the self teaching way. The way I learn most things.
 
catocom said:
I figure it's probably a path/permision problem of some kind too, but
I'm not sure.
I've tried...
<!--#exec cgi="/cgi-bin/footer.pl"-->
<!--#exec cgi="cgi-bin/footer.pl"-->
<!--#exec cgi="/footer.pl"-->
<!--#exec cgi="footer.pl"-->
and
<!--#exec cgi="http://66.168.192.248/cgi-bin/footer.pl"-->
:confused:

It's getting to the point where I'm going to
have to just get away from it at least until tomarr---er um later today (notes time)

It took me 3 days just to get the perl installed, and working somewhat. :sick3:
Well, that's the self teaching way. The way I learn most things.


try
PHP:
PHP:
<?php include('pathto/footer.php'); ?>
or
ASP:
Code:
 <!--#include file="pathto/footer.asp"-->

cgi is old-school. :)
 
catocom said:
I figure it's probably a path/permision problem of some kind too, but
I'm not sure.
I've tried...
<!--#exec cgi="/cgi-bin/footer.pl"-->
<!--#exec cgi="cgi-bin/footer.pl"-->
<!--#exec cgi="/footer.pl"-->
<!--#exec cgi="footer.pl"-->
and
<!--#exec cgi="http://66.168.192.248/cgi-bin/footer.pl"-->
:confused:

It's getting to the point where I'm going to
have to just get away from it at least until tomarr---er um later today (notes time)

It took me 3 days just to get the perl installed, and working somewhat. :sick3:
Well, that's the self teaching way. The way I learn most things.
Something I just thought of (and am fighting myself on my webservers)....cgi-bin needs to be executeable by apache. Might have to take a look at your configuration to see if it allows cgi's. Not sure how to do this with 2k3.
 
Mirlyn, there's no need to put the <?php ... ?> anymore, it is enough to use <? ... ?> :)
 
even so, i think using <?php would still help to clarify what it is you're looking at, especially for someone who might be looking at a piece of code for the first time. i'm usually anally old fashioned in my coding for the sake of backwards compatibility and readablility.
 
I made a php test doc.
It does the same as the html did...
Just a blank page. No errors, (not even in the server error.log)
just a blank page.:(
 
I'm still thinking it's got something to do with the paths/and permissions.
I can't see anything wrong with the code. (unless it's in the path somehow)

edit:
(for some reason it double posted here on me)
 
catocom said:
I'm still thinking it's got something to do with the paths/and permissions.
I can't see anything wrong with the code. (unless it's in the path somehow)

edit:
(for some reason it double posted here on me)
are the other files in the same folder as your test.php file? Is it readable by apache (don't know how you check that in windows...)?
 
Luis G said:
Mirlyn, there's no need to put the <?php ... ?> anymore, it is enough to use <? ... ?> :)
Yeah, as tommy said, its easier for others to read when you mix code. I still use <html></html> for the same reason. Old habits die hard. ;)
 
Mirlyn said:
are the other files in the same folder as your test.php file? Is it readable by apache (don't know how you check that in windows...)?

Actually I named it G.php, and it's in the root folder which
is the default htdocs.
Yeay thear are a few others in there with it, (not php files)
including the footer.txt file.

About the do you know how to check thing....
That's just it. Chmod only works if I FTP in from another machine,
with a regular FTP program, and set it, but I'm not sure if it's
really setting it. I get basically the same thing on my test website
too though, so I don't know.
It's just got to be something simple. I just can't see the forest for
the trees here. :banghead:
I'm getting so many varyations of the same name files now, that
I'm getting confused. I keep them so I can remember what I have,
and haven't tried, but I'm just about to the point of dropping the
whole thing (and erasing the extras) for a couple of days, then
come back at it.
 
catocom said:
Actually I named it G.php, and it's in the root folder which
is the default htdocs.
Yeay thear are a few others in there with it, (not php files)
including the footer.txt file.

About the do you know how to check thing....
That's just it. Chmod only works if I FTP in from another machine,
with a regular FTP program, and set it, but I'm not sure if it's
really setting it. I get basically the same thing on my test website
too though, so I don't know.
It's just got to be something simple. I just can't see the forest for
the trees here. :banghead:
I'm getting so many varyations of the same name files now, that
I'm getting confused. I keep them so I can remember what I have,
and haven't tried, but I'm just about to the point of dropping the
whole thing (and erasing the extras) for a couple of days, then
come back at it.
Ok, so G.php is sitting in your root folder with footer.txt. G.php has
PHP:
include('footer.txt');
in it. footer.txt has "this is a test" in it.

Still nothing?
 
Back
Top