can't access .gif in cgi-bin directory

colet

Member
Apr 26, 2006
22
0
151
Hello,

When I try to serve a gif in my cgi-bin directory, I get 500 Internal Server Error and the error_log shows:
Premature end of script headers: /home/myhome/public_html/cgi-bin/my.gif

Searching the forum just shows problems with cgis not working.

I've editted my http.conf:
<Directory "/usr/local/apache/cgi-bin">
#AllowOverride None
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>

and added:
<Files ~ "\.gif$">
Options FollowSymLinks
Allow from all
</Files>

Then restarted apache, but I still get this error. I can work around the problem, but I'd like to understand why this doesn't work.

Thanks for any tips!

--
Cole
 

sparek-3

Well-Known Member
Aug 10, 2002
2,173
280
388
cPanel Access Level
Root Administrator
You mention the gif file is at /home/myhome/public_html/cgi-bin/my.gif but say that you are making changes to code:

<Directory "/usr/local/apache/cgi-bin">

This is not the same.

I think the actual reason that you are seeing this message is because CPanel setups user's cgi-bin directories as a ScriptAlias. You will see this the VirtualHost section for that specific account.

The real issue is, why are you wanting to call an image in the cgi-bin directory? The cgi-bin directory is really intended for CGI scripts and is not set up to handle regular files such as images. I think a better solution would be to place this image into another directory on the account and call the images from that directory rather than from the cgi-bin directory.
 

colet

Member
Apr 26, 2006
22
0
151
Thanks for taking the time to reply.

I'm running htdig and have some menu bar js in the results header that is looking in the current working directory for arrow.gif. I thought I might just put a symlink to the real gif next to htsearch and be done with it. I've settled with mod rewrite as a workaround for now. I would just edit the java script, but it's not my code and I don't want it to break each time the site is updated.

--
Cole