Apache or Perl problem - image won't display

Apache or Perl problem - image won't display

Post by Antho » Wed, 05 Dec 2001 19:35:27


Hello,

I am running Apache v1.3.22 on Windows 2000, and I have a problem
where images won't display when a cgi page is served.  I'm using
ActiveState's Perl package to have Perl for Windows 2000.

Here is the code I'm using in a file called message.cgi:

<body bgcolor=$backcolor text=#000000 leftmargin=0 topmargin=1
 background=\"iback02.jpg\" bgproperties=\"fixed\" noscroll
 marginwidth=0 marginheight=0>

When I call message.cgi from a browser, it works properly, except the
background image does not load.  I have tried just putting the image
in the body of the document with an <img> tag, and that also does not
display the image.

I have a copy of iback02.jpg in my cgi-bin folder, as well as in the
folder of the page that calls message.cgi.  What's more, I've tried
using an absolute reference for "background=" and it STILL doesn't
work.

What am I doing wrong?

I'm sorry if this is OT -- it's just that I don't know where my
problem lies.

Thanks,
Anthony
www.NoDivisions.com

 
 
 

Apache or Perl problem - image won't display

Post by Rasputi » Wed, 05 Dec 2001 20:24:22


In the last exciting episode of comp.infosystems.www.servers.unix,
Anthony said:

Quote:> Hello,

> I am running Apache v1.3.22 on Windows 2000, and I have a problem

So I see :)
Anything in the logs?

Quote:> where images won't display when a cgi page is served.  I'm using
> ActiveState's Perl package to have Perl for Windows 2000.
> I have a copy of iback02.jpg in my cgi-bin folder, as well as in the
> folder of the page that calls message.cgi.  What's more, I've tried
> using an absolute reference for "background=" and it STILL doesn't
> work.

I remember trying to setup Slashcode once, and getting into
a situation where Apache was trying ot execute images as CGI.
Wonder if that's your problem - try moving the jpg out of the cgi-bin directory.

--
My theology, briefly, is that the universe was dictated but not
signed.
                -- Christopher Morley
Rasputin :: Jack of All Trades - Master of Nuns ::

 
 
 

Apache or Perl problem - image won't display

Post by adam » Wed, 05 Dec 2001 22:15:13



> I am running Apache v1.3.22 on Windows 2000, and I have a problem
> where images won't display when a cgi page is served.  I'm using
> ActiveState's Perl package to have Perl for Windows 2000.

> Here is the code I'm using in a file called message.cgi:

> <body bgcolor=$backcolor text=#000000 leftmargin=0 topmargin=1
>  background=\"iback02.jpg\" bgproperties=\"fixed\" noscroll
>  marginwidth=0 marginheight=0>

> When I call message.cgi from a browser, it works properly, except the
> background image does not load.  I have tried just putting the image
> in the body of the document with an <img> tag, and that also does not
> display the image.

> I have a copy of iback02.jpg in my cgi-bin folder, as well as in the
> folder of the page that calls message.cgi.  What's more, I've tried
> using an absolute reference for "background=" and it STILL doesn't
> work.

> What am I doing wrong?

As the other poster mentioned, you'll need to move your .jpg out of the
cgi-bin.  If you put it in your document root, you'll want to change
that html snippet to read "/iback02.jpg".

See:
http://httpd.apache.org/docs/mod/mod_alias.html
"The ScriptAlias directive has the additional effect of marking the
target directory as containing only CGI scripts."

--
-adam                 | "Be liberal in what you accept, and
Systems Administrator |  conservative in what you send"
Indiana University    |      -Jon Postel
Bloomington, Indiana  |

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Thu, 06 Dec 2001 04:02:00


Quote:> try moving the jpg out of the cgi-bin directory.

I've tried that, first with a relative address, and then with an
absolute address, as the argument to background= and to <img src=>.
Still didn't work.

Anthony
www.NoDivisions.com

 
 
 

Apache or Perl problem - image won't display

Post by adam » Thu, 06 Dec 2001 04:29:03



> > try moving the jpg out of the cgi-bin directory.

> I've tried that, first with a relative address, and then with an
> absolute address, as the argument to background= and to <img src=>.
> Still didn't work.

So what did the access_log lines look like for the browser's request for
this file?  And if those were failed requests, what do the error_log
lines say (no such file, permission denied)?

--
-adam                 | "Be liberal in what you accept, and
Systems Administrator |  conservative in what you send"
Indiana University    |      -Jon Postel
Bloomington, Indiana  |

 
 
 

Apache or Perl problem - image won't display

Post by Alan J. Flavel » Thu, 06 Dec 2001 04:30:25


On Dec 4, Anthony inscribed on the eternal scroll:

Quote:> > try moving the jpg out of the cgi-bin directory.

> I've tried that,

well, you were already told by two people that you needed to do it,
and one of them even told you why.  I'm sure they were right.

Quote:> first with a relative address, and then with an
> absolute address, as the argument to background= and to <img src=>.

You're not helping yourself.  You fail to show clearly what you are
doing - your description is hopelessly vague and could be interpreted
in so many ways, it's phrased in a way that suggests your mental model
of what you are doing is incomplete, but it's unclear just where
you're going wrong.  You failed to answer at least one direct question
that you were asked by one of the other contributors, and finally you
make yourself look a complete idiot by saying:

Quote:> Still didn't work.

Sure, we know that it "didn't work", otherwise you wouldn't be
continuing this thread.  If you won't show more of your working,
you're going to exasperate anyone who would like to help.

Ideally I'd ask for the URLs of your test cases so that we can see
them for ourselves and maybe try a fix or two, but I guess you're
trying to work this out in the privacy of your own server, not hooked
up to the Internet...

Consider http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

And of course there's probably nothing wrong with any unix web server,
or indeed with a web server of any OS, so you're off-beam on this
group.  I would suggest comp.infosystems.www.authoring.cgi, though I
suspect the problem is at a more elementary level.

Where did you tell us that you've actually viewed this image at its
absolute URL where you suppose it to be?  This would be an obvious
elementary test to try, but you don't seem to have mentioned having
tried it.

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Thu, 06 Dec 2001 10:30:10


Alan, you couldn't be any more rude or any less helpful.  Please don't
respond to any of my posts in the future.

Anthony

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Thu, 06 Dec 2001 10:55:54


Rasputin and Adam,

When I got home tonight and had a chance to check my log files, I
found that Apache/Perl was indeed trying to execute the image as a CGI
script.  Here's the lines from my error log for one of the requests:

[error] [client 192.168.0.10] e:/usr/www/cgi-bin/iback02.jpg is not
executable; ensure interpreted scripts have "#!" first line
[error] [client 192.168.0.10] couldn't spawn child process:
e:/usr/www/cgi-bin/iback02.jpg

And as I said before, I had already tried moving the image out of the
cgi-bin directory, to no avail.  But, Adam, your response was the
answer -- I needed the forward-slash before the filename when I moved
the image out of the cgi-bin directory.  That's messed me up before
once or twice with Apache.

My only remaining question is, why doesn't it work when I use an
absolute reference as the source for the image?  When I put this into
my message.cgi:

<body background=\"http:\/\/www.google.com\/images\/logo.gif\">

...it doesn't work.  Any ideas about that one?

Thanks for your help,
Anthony
www.NoDivisions.com

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Thu, 06 Dec 2001 11:06:52


Ok, now my problem is completely solved.  The problem with the
absolute references was that I didn't need to escape the
forward-slashes with back-slashes.  Instead of:

<body background=\"http:\/\/www.google.com\/images\/logo.gif\">

... I should have just used:

<body background=\"http://www.google.com/images/logo.gif\">

The cgi script that I found on the internet and modified a little
(message.cgi) always escaped forward-slashes like that, so I thought I
had to.  But I guess not!

Thanks again everyone for your help.

Anthony
www.NoDivisions.com

 
 
 

Apache or Perl problem - image won't display

Post by Bob » Sun, 09 Dec 2001 03:47:27


Quote:> I am running Apache v1.3.22 on Windows 2000, and I have a problem
> where images won't display when a cgi page is served.  I'm using
> ActiveState's Perl package to have Perl for Windows 2000.

It is probably try to run the image as a program.
Can you access just the image from an URL
eg. http://localhost/path/image.jpg?
 
 
 

Apache or Perl problem - image won't display

Post by Randal L. Schwar » Wed, 12 Dec 2001 01:03:49


Anthony> Alan, you couldn't be any more rude or any less helpful.  Please don't
Anthony> respond to any of my posts in the future.

I saw nothing in his post that was either rude or unhelpful, except
that it put the onus on you to tell us *enough* to give sensible
answers to your problem.  Do you expect us to be psychic?

If you don't want Alan to respond, don't post to a public forum.

On the other hand, you've just likely been killfiled by many people
who respect Alan's contribution (perhaps even Alan himself), so don't
expect many answers from experts here any more anyway. :)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Wed, 12 Dec 2001 10:17:38


Randal, in my opinion Alan's post was rude and unhelpful.  Assuming
that a person is entitled to his own opinion, it's entirely logical
for me to request that Alan not respond to my future posts.  If I
believe that his attitude prohibits helpful responses, then I don't
want to hear his responses.

Adam was able to give a sensible (and moreover, correct) answer to my
problem based on the information I supplied.  According to you that
makes him psychic, but I would say that makes him helpful and
knowledgeable.  He apparently didn't feel the need to be egotistical,
and I'd say that he didn't think putting me down would help solve my
problem.  He also didn't write 300 words that had absolutely nothing
to do with my problem or any possible solution to it.

I think it would be drastic and rather ridiculous for a person to
killfile me simply because I found Alan's post to be rude and
unhelpful.  But if someone wants to do that, that's their choice.
Again, an action like that is certainly not helpful to someone who
needs help, and seems rather against the spirit of usenet.  On the
other hand, such a person likely has an attitude similar to the one
Alan exhibited in his post, so I wouldn't benefit from their response
anyway.

If a person respects Alan's contribution, that's fine, but killfiling
me just because I DON'T respect this particular contribution would
indicate that they worship Alan, not that they simply "respect his
contribution."  I'm not really interested in such games, and I'm not
going to lose sleep thinking about how such people may not respond to
my posts.  If the only answers I get are like the one that Adam gave,
that's fine with me.

-Anthony

 
 
 

Apache or Perl problem - image won't display

Post by Randal L. Schwar » Fri, 14 Dec 2001 01:50:10


Anthony> Adam was able to give a sensible (and moreover, correct) answer to my
Anthony> problem based on the information I supplied.

Adam *guessed* that you were confused about relative and absolute
URIs.  He was lucky, as that turned out to be what you were missing
although nothing you had posted had suggested that.  It was along the
lines of "try this, this is one of the many possible problems here".

Since you had not included any code, Alan requested more input,
because it was just as likely to be that problem as any other.  Alan
has many more years experience in customer support apparently, and
refuses (like I do) from making wild guesses about causes until
information is given.

And you still didn't address that this wasn't a "servers.unix" issue.
This was a CGI issue, so you were in the wrong newsgroup.  Not only
that, but not being clear about URI addressing is something you should
work out *long before* you even attempt CGI.  In fact, Alan might have
had a hard time believing that your problem was with URI addressing,
given that you should have had that down long ago.

Since you seem to confuse "request for more input" and "hey, you might
be in the wrong newsgroup" as personal attacks, perhaps you could look
into counseling, or maybe staying away from online group discussions
until you've got a bit more real-world experience with feedback?

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

 
 
 

Apache or Perl problem - image won't display

Post by Antho » Fri, 14 Dec 2001 07:25:10


Randal,

Quote:> And you still didn't address that this wasn't a "servers.unix" issue.

In fact I addressed that in my original post.  If you had READ my
original post, you would know that I stated that my question was
likely OT.  I wasn't sure where my problem lied -- whether with
CGI/Perl or Apache -- so I could well have been posting in the wrong
place, as I said.

Quote:> not being clear about URI addressing is something you should
> work out *long before* you even attempt CGI.

Oh, right, because then I'd be incapable of making a mistake, or ever
needing to ask for help.  And of course EVERYONE knows that you MUST
have URI addressing down before attempting CGI; that's just inherent
human knowledge.  I'm sorry that I'm so ignorant that I missed this
obvious web development rule.  Thank you for enlightening me.

Ok, I admit, Adam IS psychic.  He didn't even read my post, he just
made a wild guess that happened to be right.  Sure....  If "nothing I
had posted suggested that" then why did he suggest it as a solution?
Pure chance?  You're either lying to me, or lying to yourself, because
he obviously made his response based on what he read in my post.

And I suppose "perhaps you should look into counseling" is not a
personal attack either.

If you're just here to argue about the technicalities of a post that
has already been solved by someone else, then just stop wasting
everyone's time because this is not entertaining.

-Anthony

 
 
 

1. zgv won't display images if I'm not root

Hello,

I use mutt and I'm interested in zvg to see the pictures that are in
my emails.
When I start zgv from aterm for exemple, I get this message

zgv: you must be the owner of the current console to run zgv.

When I am root, it works. How can I enable it for normal user.

Also, does someone has a sample of a mailcap that include a line
relative to zgv and images?

Thank you

Bye

2. Need solaris8 part2 exam braindumps

3. knews won't display images

4. PPP, and nameserver?, problem

5. TIFF image files won't download and display

6. News reader with authorization

7. Newbie question -- Images won't display

8. rPerf statistics for older machines

9. Sparc 20 won't boot and won't display errors, either.

10. Apache CGI won't run Perl!

11. Help...Apache won't use PERL

12. Apache: Virtual Servers won't load images ?!