You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Can Le <le...@yahoo.com> on 2007/05/04 20:03:56 UTC

[users@httpd] How to dsiplay photo from cgi-bin

Hi friends,
  
  Apache2 can display photo.jpg in my localhost/htdocs but my localhost/cgi-bin can't show the same photo.jpg.
  
  Please show me why or the missing AddType or  AddHandler ?
  
  Thank you for your helps
  
  Can
  

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: [users@httpd] How to dsiplay photo from cgi-bin

Posted by Joshua Slive <jo...@slive.ca>.
On 5/6/07, Can Le <le...@yahoo.com> wrote:
> On 2. Link suggested:
> Alias /cgi-bin /var/www/cgi-bin
> <Directory /var/www/cgi-bin>
>  AddHandler cgi-script cgi pl
>  Options ExecCGI
> </Directory>
>
> Should I add .jpg after "cgi pl " as "cgi pl jpg "

No. That is exactly the point: you DON'T want jpg to be treated as a cgi-script.

> or add image.jpg into another directory such as:
>
> /cgi-bin/photo/image.jpg ?

It doesn't matter whether it is in a subdirectory or not.

>
> The file image.jpg is also working OK in cgi-bin
> when the output text file has a html tag for
> <img src.....jpg
>
>  However, below url won't display:
>
> http://localhost/cgi-bin/image.jpg

For apache there is absolutely no difference between these two cases,
so it must be some other error you're making. Are you sure the img src
points to the same place? Are you sure you cleared your cache, etc?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to dsiplay photo from cgi-bin

Posted by Can Le <le...@yahoo.com>.
Thank Joshua 
  
  Slive <jo...@slive.ca>  wrote:.....
  1. Move your photo.jpg someplace else.
  2. Reconfigure apache:http://wiki.apache.org/httpd/Errors/DirectoryAsScript
  
  On 1. It works when I moved image.jpg to htdocs: 
  
  http://localhost/image.jpg   
On 2. Link suggested: 
Alias /cgi-bin /var/www/cgi-bin
<Directory /var/www/cgi-bin>
 AddHandler cgi-script cgi pl
 Options ExecCGI
</Directory>

Should I add .jpg after "cgi pl " as "cgi pl jpg "
or add image.jpg into another directory such as:

/cgi-bin/photo/image.jpg ?

The file image.jpg is also working OK in cgi-bin 
when the output text file has a html tag for 
<img src.....jpg 

  
However, below url won't display:

http://localhost/cgi-bin/image.jpg
  Thank you

 
---------------------------------
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.

Re: [users@httpd] How to dsiplay photo from cgi-bin

Posted by Joshua Slive <jo...@slive.ca>.
On 5/4/07, Can Le <le...@yahoo.com> wrote:
> Hi friends,
>
>  Apache2 can display photo.jpg in my localhost/htdocs but my
> localhost/cgi-bin can't show the same photo.jpg.
>
>  Please show me why or the missing AddType or  AddHandler ?

By using a ScriptAlias directive to map a cgi-bin directory, you are
explicitly asking for everything in that directory to be treated as a
CGI script. There are two solutions:

1. Move your photo.jpg someplace else.

2. Reconfigure apache:
http://wiki.apache.org/httpd/Errors/DirectoryAsScript

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org