Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Set HTTP Status code

by quester (Vicar)
on Nov 16, 2011 at 06:30 UTC ( #938319=note: print w/ replies, xml ) Need Help??


in reply to Set HTTP Status code

First check the HTTP server's access and error logs. There will probably be a message in the error log saying that test.pl was not found, but you may find a more specific reason. If not, you will have to figure out why the server can't find (or can't open) the script.

There are several possibilities. First, check that the URL you use really corresponds to the directory where the script is. Commonly, a test.pl script would be in a cgi-bin directory and the URL needs to end in .../cgi-bin/test.pl.

Another possibility is that test.pl is not executable by the HTTP server; an ls -l will show you if the appropriate execute bits are missing, or if the file ownership isn't what you expected.


Comment on Re: Set HTTP Status code
Re^2: Set HTTP Status code
by molybtek (Novice) on Nov 16, 2011 at 22:39 UTC

    We are using Apache 2.2 web server.

    The server does find the code and is executing it - if I removed the code to change the status, it will display the output from the program, and the status is 200 OK.

    However, I want it to display a status of 404 Not Found, so when I included the code $self->header_props(-status => 404);, I get the error message instead of the output from the program.

    I've checked the error log, there are no entry for it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938319]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2014-12-19 21:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (92 votes), past polls