Pictures will not print and Gets errors with script, Why?

Pictures will not print and Gets errors with script, Why?

am 08.10.2005 07:45:07 von flyaway840

Below is the script and the errors, when I try to
create a page with pictures on it, they don't show up,
why? It seem you have to somehow open the file or
something. But when I copy the source from IE and
go through the broswer of course the pictures show.
The pictures are in the cgi-bin directory.
(I'm new at perl)


[Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
C:/www/apache/cgi-bin/1.gif is not executable; ensure interpreted
scripts have "#!" first line, referer:
http://localhost/cgi-bin/banner.pl?
[Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1] (9)Bad file
descriptor: don't know how to spawn child process:
C:/www/apache/cgi-bin/1.gif, referer:
http://localhost/cgi-bin/banner.pl?
[Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
C:/www/apache/cgi-bin/ban.gif is not executable; ensure interpreted
scripts have "#!" first line, referer:
http://localhost/cgi-bin/banner.pl?
[Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1] (9)Bad file
descriptor: don't know how to spawn child process:
C:/www/apache/cgi-bin/ban.gif, referer:
http://localhost/cgi-bin/banner.pl?



#!/usr/bin/perl

use strict;


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

print <


Site




bgColor=#ffffff>








EOHTML

Re: Pictures will not print and Gets errors with script, Why?

am 08.10.2005 09:08:06 von Joe Smith

flyaway840@hotmail.com wrote:

> The pictures are in the cgi-bin directory.

Don't put your pictures in the cgi-bin directory!

> [Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
> C:/www/apache/cgi-bin/1.gif is not executable

That is the reason why you should not put pictures in the
cgi-bin directory; the web server expects everything
in that directory to be executable. No pictures, no data.

-Joe

Re: Pictures will not print and Gets errors with script, Why?

am 08.10.2005 20:36:26 von webmaster

In message <1128750306.997656.170740@g43g2000cwa.googlegroups.com>
flyaway840@hotmail.com wrote:

> The pictures are in the cgi-bin directory.
> (I'm new at perl)

I'm new at perl as well, which is why I won't even attempt to answer your
original question. However I think I am correct in saying that you should
not store your pictures in you cgi-bin. Keep that for programs lest it get
cluttered and you fail to spot the virus that some hacker has inserted.

Ken Down

--
================ ARCHAEOLOGICAL DIGGINGS ===============
| Australia's premiere archaeological magazine |
| http://www.diggingsonline.com |
========================================================

Re: Pictures will not print and Gets errors with script, Why?

am 09.10.2005 05:27:36 von flyaway840

Joe Smith wrote:
> flyaway840@hotmail.com wrote:
>
> > The pictures are in the cgi-bin directory.
>
> Don't put your pictures in the cgi-bin directory!
>
> > [Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
> > C:/www/apache/cgi-bin/1.gif is not executable
>
> That is the reason why you should not put pictures in the
> cgi-bin directory; the web server expects everything
> in that directory to be executable. No pictures, no data.
>
> -Joe


It does not matter where I put them, I get the same
result, the pictures do not show up. I only put it
there for ease and this post. What will force the
pictures to show up as if you called the html page
through the broswer?

In otherwords why don't they show up using perl
to create the page?


Thanks

Re: Pictures will not print and Gets errors with script, Why?

am 09.10.2005 12:39:54 von Justin C

On 2005-10-08, flyaway840@hotmail.com wrote:
>
>
>

>

Try:







Justin.

--
Justin C, by the sea.

Re: Pictures will not print and Gets errors with script, Why?

am 09.10.2005 14:03:18 von Sherm Pendley

Justin C writes:

> On 2005-10-08, flyaway840@hotmail.com wrote:
>>
>>
>>

>>
>
> Try:
>
>
>

>

He's getting errors because, when his browser tries to load the images
from /cgi-bin, the server tries to execute them instead of serving them
straight-up. The solution is simple - don't put non-executable content
in /cgi-bin.

What sort of bizarro illogic led you to imagine that the above proposal
would make any difference whatsoever?

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 09.10.2005 16:39:58 von Matt Garrish

wrote in message
news:1128828455.950425.120820@f14g2000cwb.googlegroups.com.. .
>
> Joe Smith wrote:
>> flyaway840@hotmail.com wrote:
>>
>> > The pictures are in the cgi-bin directory.
>>
>> Don't put your pictures in the cgi-bin directory!
>>
>> > [Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
>> > C:/www/apache/cgi-bin/1.gif is not executable
>>
>> That is the reason why you should not put pictures in the
>> cgi-bin directory; the web server expects everything
>> in that directory to be executable. No pictures, no data.
>
>
> It does not matter where I put them, I get the same
> result, the pictures do not show up. I only put it
> there for ease and this post. What will force the
> pictures to show up as if you called the html page
> through the broswer?
>
> In otherwords why don't they show up using perl
> to create the page?
>

Have you updated the path to the images in the tag? By default a
browser will retrieve other files relative to the page being called if you
just specify a name. In this case, the browser calls the script from the
cgi-bin, so it will look for the graphics in your cgi-bin as well. The other
possibility is that for some reason you've made a directive to execute gif
files in your httpd.conf file.

You can rest assured that is has nothing to do with perl. Once the content
from your cgi is returned to the browser, any subsequent errors indicate a
problem with your browser or site configuration (perl is no longer a part of
the equation).

If the above is no help in resolving the problem, I would strongly suggest
you take this issue to a newsgroup that deals with Apache. You're not likely
to get much else help in a perl group understanding why the server is trying
to execute your gif files.

Matt

Re: Pictures will not print and Gets errors with script, Why?

am 09.10.2005 17:36:34 von Justin C

On 2005-10-09, Sherm Pendley wrote:
>
> What sort of bizarro illogic led you to imagine that the above proposal
> would make any difference whatsoever?

Nice to see politeness and tolerance is still alive and well on usenet.

Justin.

--
Justin C, by the sea.

Re: Pictures will not print and Gets errors with script, Why?

am 10.10.2005 04:59:51 von flyaway840

Sherm Pendley wrote:
> Justin C writes:
>
> > On 2005-10-08, flyaway840@hotmail.com wrote:
> >>
> >>
> >>

> >>
> >
> > Try:
> >
> >
> >

> >
>
> He's getting errors because, when his browser tries to load the images
> from /cgi-bin, the server tries to execute them instead of serving them
> straight-up. The solution is simple - don't put non-executable content
> in /cgi-bin.
>
> What sort of bizarro illogic led you to imagine that the above proposal
> would make any difference whatsoever?


The problem is more than that, because any place I call
the script from and any place I put the pictures they
still do not show up, and I get errors as:

Thu Oct 10 08:16:53 2005] [error] [client 127.0.0.1] script not found
or unable to stat: C:/www/apache/cgi-bin/images, referer:
http://localhost/cgi-bin/banner.pl?

I notice in the above however that the path is
C:/www/apache/cgi-bin/images
But I am calling the script from the directory c:\webpage
and the images are in c:\webpage\images\ from a page that
calls the script by http://localhost/cgi-bin/banner.pl

If I put file:///c:/webpage/images/ perl cuts off the file:///c:/
and it shows up as webpage/images/1.gif but I get the above
error and the picture will not show up. If I save the source
generated and run it in IE, the pictues show up fine.


Unrelated to this when I put a if statement in a while or
for loop I always get a Internal Server Error. And it says
syntax error near ") {" pointing at the if statement which
is written correctly. as
if ($count >= 5) {
print "whatever";
}


>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 10.10.2005 13:26:58 von Sherm Pendley

flyaway840@hotmail.com writes:

> Sherm Pendley wrote:
>> Justin C writes:
>>
>> He's getting errors because, when his browser tries to load the images
>> from /cgi-bin, the server tries to execute them instead of serving them
>> straight-up. The solution is simple - don't put non-executable content
>> in /cgi-bin.
>>
>> What sort of bizarro illogic led you to imagine that the above proposal
>> would make any difference whatsoever?
>
>
> The problem is more than that

That's the problem you originally described, as reported by the error messages
you posted here:

Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
C:/www/apache/cgi-bin/1.gif is not executable; ensure interpreted
scripts have "#!" first line, referer:
http://localhost/cgi-bin/banner.pl?

The problem here is clear - the server is trying to run 1.gif as a CGI, but it
can't because 1.gif is not a program or script. The solution is equally clear -
since the server treats *everything* in /cgi-bin as a CGI, put the image else-
where.

> because any place I call
> the script from and any place I put the pictures they
> still do not show up, and I get errors as:
>
> Thu Oct 10 08:16:53 2005] [error] [client 127.0.0.1] script not found
> or unable to stat: C:/www/apache/cgi-bin/images, referer:
> http://localhost/cgi-bin/banner.pl?

That's a different error, and has no bearing on whether my statement concerning
your original error is correct or not.

> I notice in the above however that the path is
> C:/www/apache/cgi-bin/images
> But I am calling the script from the directory c:\webpage

The location of the banner.pl script is key here.

Somewhere in the output of banner.pl, you have an image element that refers to
"images", with no filename. That indicates two problems. First, of course, is
the lack of the filename. If you mean to refer to a directory, to get a list of
the files in it, add a trailing slash to indicate that - i.e. "images/".

The second problem is that "images/" is relative to the page it's in. Since
that page is produced by "/cgi-bin/banner.pl", the result is "/cgi-bin/images",
which is not correct. Since you're referring to something that's outside of the
current directory, you need to include a full path: "/images/1.gif" (note the
leading "/").

> If I put file:///c:/webpage/images/ perl cuts off the file:///c:/
> and it shows up as webpage/images/1.gif

Define "put". How do you "put" that text, and where do you "put" it? Just post
your code, don't try to describe it.

> but I get the above error

The above error is not consistent with the URL you give. Please post the real
error, and the real URL.

> Unrelated to this when I put a if statement in a while or
> for loop I always get a Internal Server Error. And it says
> syntax error near ") {" pointing at the if statement which
> is written correctly.

If your code were written correctly, Perl would not produce a syntax error.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 12.10.2005 04:52:31 von flyaway840

Sherm Pendley wrote:
> flyaway840@hotmail.com writes:
>
> > Sherm Pendley wrote:
> >> Justin C writes:
> >>
> >> He's getting errors because, when his browser tries to load the images
> >> from /cgi-bin, the server tries to execute them instead of serving them
> >> straight-up. The solution is simple - don't put non-executable content
> >> in /cgi-bin.
> >>
> >> What sort of bizarro illogic led you to imagine that the above proposal
> >> would make any difference whatsoever?
> >
> >
> > The problem is more than that
>
> That's the problem you originally described, as reported by the error messages
> you posted here:
>
> Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
> C:/www/apache/cgi-bin/1.gif is not executable; ensure interpreted
> scripts have "#!" first line, referer:
> http://localhost/cgi-bin/banner.pl?
>
> The problem here is clear - the server is trying to run 1.gif as a CGI, but it
> can't because 1.gif is not a program or script. The solution is equally clear -
> since the server treats *everything* in /cgi-bin as a CGI, put the image else-
> where.
>
> > because any place I call
> > the script from and any place I put the pictures they
> > still do not show up, and I get errors as:
> >
> > Thu Oct 10 08:16:53 2005] [error] [client 127.0.0.1] script not found
> > or unable to stat: C:/www/apache/cgi-bin/images, referer:
> > http://localhost/cgi-bin/banner.pl?
>
> That's a different error, and has no bearing on whether my statement concerning
> your original error is correct or not.
>
> > I notice in the above however that the path is
> > C:/www/apache/cgi-bin/images
> > But I am calling the script from the directory c:\webpage
>
> The location of the banner.pl script is key here.
>
> Somewhere in the output of banner.pl, you have an image element that refers to
> "images", with no filename. That indicates two problems. First, of course, is
> the lack of the filename. If you mean to refer to a directory, to get a list of
> the files in it, add a trailing slash to indicate that - i.e. "images/".
>
> The second problem is that "images/" is relative to the page it's in. Since
> that page is produced by "/cgi-bin/banner.pl", the result is "/cgi-bin/images",
> which is not correct. Since you're referring to something that's outside of the
> current directory, you need to include a full path: "/images/1.gif" (note the
> leading "/").
>
> > If I put file:///c:/webpage/images/ perl cuts off the file:///c:/
> > and it shows up as webpage/images/1.gif
>
> Define "put". How do you "put" that text, and where do you "put" it? Just post
> your code, don't try to describe it.

Sorry to take so long in replying, I use one laptop for perl and
one for the internet. The perl computer crashed and I cannot at the
moment get them talking to each other.

I "put" the urls in a file, and it is opened in banner.pl, then
the entries are put into an array where each are line by line
read and assigned to a varible, as $bann. The looks something like:



in the file I have used:

c:\webpage\images\1.gif
c:/webpage/images/1.gif
file:///c:/webpage/images/1.gif
/images/1.gif
1.gif

and have put the images in \cgi-bin which you already
know what happened, and in \webpage and in \webpage\images\

still the pictures do not show up. I have called the script
from the \cgi-bin directory as well as the \webpage directory.
Ok let me ask it directly: if the banner.pl is in the \cgi-bin
directory, and the html page that calls the banner.pl script
is in the \webpage directory, what path should I use to
have the pictures show up, without any errors?


Thanks



>
> > but I get the above error
>
> The above error is not consistent with the URL you give. Please post the real
> error, and the real URL.
>
> > Unrelated to this when I put a if statement in a while or
> > for loop I always get a Internal Server Error. And it says
> > syntax error near ") {" pointing at the if statement which
> > is written correctly.
>
> If your code were written correctly, Perl would not produce a syntax error.
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 12.10.2005 13:47:58 von Sherm Pendley

flyaway840@hotmail.com writes:

> in the file I have used:
>
> c:\webpage\images\1.gif
> c:/webpage/images/1.gif
> file:///c:/webpage/images/1.gif
> /images/1.gif
> 1.gif
>
> and have put the images in \cgi-bin which you already
> know what happened, and in \webpage and in \webpage\images\
>
> still the pictures do not show up. I have called the script
> from the \cgi-bin directory as well as the \webpage directory.
> Ok let me ask it directly: if the banner.pl is in the \cgi-bin
> directory, and the html page that calls the banner.pl script
> is in the \webpage directory, what path should I use to
> have the pictures show up, without any errors?

Suppose you have a CGI at this URL:

http://invalid.com/cgi-bin/hello.pl

Now suppose you have an image at this URL:

http://invalid.com/images/1.gif

To place this image in the page that's printed by the CGI, you use
an img element like this:



Because the image isn't in the same directory as the CGI, you have
to spell out the full path. If the image were on a different server,
you'd have to supply the server name too.

BTW, the fact that this happens to be a CGI isn't all that important
here. If you were placing the same image in a page at:

http://invalid.com/foo/bar/baz/hello.html

You'd have *precisely* the same issue. The image isn't at the same
location as the page, so you need to include the path in the src
attribute.



Keep in mind that there may also a web server configuration issue to
be aware of here. When the server receives a request for /images, it
has to translate that to a location on disk. That might be c:\images,
c:\someplace\else\images, or whatever.

So, let's say you've stored your image in c:\webpage\images\1.gif,
and you expect to refer to it as /images/1.gif in HTML. If you go to
your browser and load up http://invalid.com/images/1.gif, and the
server produces an error like this:

Could not stat file c:\foo\bar\baz\images\1.gif

In this case, what you have is a misconfigured server. You expected
the "server root" to be c:\webpage, but it's c:\foo\bar\baz instead.
You couldn't fix that by writing your image src differently - you'd
have to correct the server configuration.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 12.10.2005 21:47:15 von Joe Smith

flyaway840@hotmail.com wrote:
> Joe Smith wrote:
>>>[Mon Dec 07 07:24:59 1998] [error] [client 127.0.0.1]
>>>C:/www/apache/cgi-bin/1.gif is not executable
>>
>>That is the reason why you should not put pictures in the
>>cgi-bin directory; the web server expects everything
>>in that directory to be executable. No pictures, no data.
>>
>> -Joe
>
>
>
> It does not matter where I put them, I get the same
> result, the pictures do not show up.

The error message you posted is specific to cgi-bin.
Whatever problem you are having now it a different one.

You need to factor your problem into smaller pieces.
1) Create a static HTML page that shows the images properly.
2) Work on getting the CGI program to produce the same HTML.
It sounds like you still haven't gotten through step 1.
-Joe

Re: Pictures will not print and Gets errors with script, Why?

am 12.10.2005 22:03:46 von Joe Smith

flyaway840@hotmail.com wrote:

>
>
> in the file I have used:
>
> c:\webpage\images\1.gif

That is a Windows-style file specification, not a URL.

> c:/webpage/images/1.gif

That is a perl-accepted file specification, not a URL.

> file:///c:/webpage/images/1.gif

That URL is in invalid for network access.

> /images/1.gif

That is OK, as long as the file is in htdocs/images.

> 1.gif

Not good; pictures should not be in the cgi-bin directory.

> and have put the images in \cgi-bin which you already
> know what happened, and in \webpage and in \webpage\images\

The latter two should work as long as htdocs (DOCUMENT_ROOT) is set.
Can you access c:\webpage\foo.html via "http://localhost/foo.html"?
What about "http://localhost/images/1.gif"?

Create two HTML pages. Put the first in \webpage\images:
In same directory
1.gif - 2.gif


Put the other one somewhere else (like \webpage\testing):
In different directory
1.gif - 2.gif


Get both of them to work before proceeding.
-Joe

Re: Pictures will not print and Gets errors with script, Why?

am 13.10.2005 05:34:25 von flyaway840

Joe Smith wrote:
> flyaway840@hotmail.com wrote:
>
> >
> >
> > in the file I have used:
> >
> > c:\webpage\images\1.gif
>
> That is a Windows-style file specification, not a URL.
>
> > c:/webpage/images/1.gif
>
> That is a perl-accepted file specification, not a URL.
>
> > file:///c:/webpage/images/1.gif
>
> That URL is in invalid for network access.
>
> > /images/1.gif
>
> That is OK, as long as the file is in htdocs/images.


I think between the two of you (& Sherm) you have given me
a hint as to what is going on. Especially with the above
htdocs/images which I think is in the apache directory.
(I'm not at that computer right now.) I will look there to
see if it is in the apache directory, and hope that works.
I will copy and paste both your emails to take with me.
As I look at it, it kind of seems obvious, because that
is how some of my sites are set up, with a htdocs directory,
and that is where you stick everything, and directories as
/images etc.

Thanks a lot

>
> > 1.gif
>
> Not good; pictures should not be in the cgi-bin directory.
>
> > and have put the images in \cgi-bin which you already
> > know what happened, and in \webpage and in \webpage\images\
>
> The latter two should work as long as htdocs (DOCUMENT_ROOT) is set.
> Can you access c:\webpage\foo.html via "http://localhost/foo.html"?
> What about "http://localhost/images/1.gif"?
>
> Create two HTML pages. Put the first in \webpage\images:
> In same directory
> 1.gif - 2.gif
>
>
> Put the other one somewhere else (like \webpage\testing):
> In different directory
> 1.gif - 2.gif
>
>
> Get both of them to work before proceeding.
> -Joe

Re: Pictures will not print and Gets errors with script, Why?

am 13.10.2005 05:44:15 von flyaway840

Thanks

As I said to Joe, between the two of you I think I now have a hint as
to
what is going on. If there is the htdocs in the apache directory
hopefully
the pictures will show up if I put them into that directory. I hope
that
is what you were kind of saying. Then all I need to do, if so, is get
the url correct, to look into the htdocs directory and the pictures
will
hopefully show up.


Thanks a lot

Re: Pictures will not print and Gets errors with script, Why?

am 13.10.2005 06:30:14 von Sherm Pendley

flyaway840@hotmail.com writes:

> As I said to Joe, between the two of you I think I now have a hint as
> to
> what is going on. If there is the htdocs in the apache directory
> hopefully
> the pictures will show up if I put them into that directory. I hope
> that
> is what you were kind of saying. Then all I need to do, if so, is get
> the url correct, to look into the htdocs directory and the pictures
> will
> hopefully show up.

Sounds like you're on the right track - "htdocs" is a very common name for
the directory that holds your web site. Keep in mind though, that "htdocs"
doesn't actually appear in the URL. The file "htdocs/images/1.gif" will be
at URL "/images/1.gif".

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Pictures will not print and Gets errors with script, Why?

am 14.10.2005 06:18:28 von flyaway840

Sherm Pendley wrote:
> flyaway840@hotmail.com writes:
>
> > As I said to Joe, between the two of you I think I now have a hint as
> > to
> > what is going on. If there is the htdocs in the apache directory
> > hopefully
> > the pictures will show up if I put them into that directory. I hope
> > that
> > is what you were kind of saying. Then all I need to do, if so, is get
> > the url correct, to look into the htdocs directory and the pictures
> > will
> > hopefully show up.
>
> Sounds like you're on the right track - "htdocs" is a very common name for
> the directory that holds your web site. Keep in mind though, that "htdocs"
> doesn't actually appear in the URL. The file "htdocs/images/1.gif" will be
> at URL "/images/1.gif".



Just wanted to thank you for your help. And if in the far
distant future, while the earth is in the grip of an ice age,
and someone makes it to these post and uses indigo perl/apache
HEY IT WORKED ! !

I put the images in htdocs/images changed the image file urls to
http://localhost/images/1.gif

ect. and wala they all showed up and no errors.

Thanks again.




>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org