Recently, I run small local host for myself, but when I write a CGI file or HTML file, it shows everything except images. Does everyone know what happen and what shall I do?
See Question&Answers more detail:osRecently, I run small local host for myself, but when I write a CGI file or HTML file, it shows everything except images. Does everyone know what happen and what shall I do?
See Question&Answers more detail:osImpossible to answer because you haven't given us anywhere near enough information. But your code does give one potential clue.
use CGI qw/:standard/;
use DBI;
print "Content-type:text/html
";
print first();
print myform();
print second();
sub myform {
return <<B;
<form action='' method='post'>
<img src="images/img0001.gif" id="Shape1" align="top" alt="" title="" border="0"
width="1344" height="126">
...
</form>
B
}
You try to serve the image from images/img0001.gif
. But that's relative to the current directory - which will almost certainly be /cgi-bin
when this code is executed. And most web servers are configured so that any files under /cgi-bin
are assumed to be CGI programs.
So I'd guess that your web server is trying to execute your image file. Which isn't going to work. What's in the web server error log?
Move any static files (html, images, css) out of the /cgi-bin
directory.