Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

File Not Found

by Loerps (Initiate)
on Mar 20, 2009 at 16:30 UTC ( [id://752103]=perlquestion: print w/replies, xml ) Need Help??

Loerps has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks, I have a Perl script that is used as a status panel using a SQL script to pull the stats and three small graphics (green, yellow, red) to indicate status. All the related files are in the cgi-bin folder (I know, this isn't standard practice, but bear with me here).

I added three new graphics to the folder and none of them can be seen by the script. If I refer to any of the original 3, no problem. If I refer to any of the new 3, no dice. I even tried renaming one of the new graphics to match the name of one of the old ones and the file is still invisible to the CGI script.

I checked the source of the HTML page that the script creates and it is correct.

Any ideas why this is happening?

Replies are listed 'Best First'.
Re: File Not Found
by ikegami (Patriarch) on Mar 20, 2009 at 16:58 UTC

    You're not clear whether it's the web client or the script that has a problem accessing the files. Also, you gave no indication as to how you arrived to the conclusion they cannot be found.

    Under Apache, all files (including images), are treated as executable in a ScriptAlias dir. cgi-bin is usually such a dir. The images don't have the executable permission set (for obvious reasons), so you should get a 403 Forbidden error, not a 404 Not Found error.

    If it's really the script that can't access the files, the two most common problems are 1) incorrect permissions, and 2) making assumptions about your current work directory when using relatives paths.

Re: File Not Found
by kennethk (Abbot) on Mar 20, 2009 at 16:36 UTC
    This question is ill-constrained and likely off-topic - see How (Not) To Ask A Question. I suspect that you have not set the file permissions on those files properly. If so, this is a server/OS issue, not a Perl/CGI issue. On *NIX, use the OS command ls -l to compare file permissions and chmod and chown to make sure the new files' permissions match the old.
      I concur, based on your scanty information. If you are sure that this is not the problem, you will need to provide a code snippet that demonstrates the problem.
Re: File Not Found
by ig (Vicar) on Mar 20, 2009 at 19:17 UTC

    To find out what is going on you must check your web server's logs and your CGI script's logs if it has its own. If there is a proxy server between your web browser and web server, you will also have to check the logs on your proxy server.

    If your script is producing correct HTML as you say then presumably the problem is with the browser accessing the files. In this case, you should find records in your web server's access log or proxy server logs that record the attempt to access the files, with some status other than 200 and a corresponding record in your web server's error log indicating the cause of the failure, which is likely that permission is denied. If you don't find these records, then it is likely that either your HTML is not correct or your web server is not logging adequately - check your web server's documentation for guidance on how to set up its logs or talk with your web server administrator.

    If it is your CGI script that is unable to access the files, it should be producing error messages. If not, then you need to improve your script to test that operations complete successfully and produce error messages when they fail to do so. Depending on how you produce your error messages, they may appear in the browser (e.g. if you use CGI::Carp with qw(fatalsToBrowser)) in your web server's error logs (e.g. if you write error messages to STDERR) or in your scripts error logs if it has its own.

Re: File Not Found
by brycen (Monk) on Mar 21, 2009 at 00:28 UTC
    In most browsers: right click on one of the displayed images, and select "view image". Now you've got just the image loaded in the browser (the working image). Now hack the filename to one of the non working images.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://752103]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-18 00:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found