Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

500 internal server error !!

by priti (Initiate)
on Aug 20, 2008 at 10:44 UTC ( [id://705475]=perlquestion: print w/replies, xml ) Need Help??

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

Hi,
try { if($session_id eq '') { #create new session $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp/'}) +; } else { #reinitialse with session with session id $session= new CGI::Session(undef, $session_id, {Directory=>'/ +tmp'}); } return $session; } catch IOException with { my $ex = shift; if (!$self->raiseException()) { warn("IOException occurred - " . $ex->getMessage()); return; } }
This is my function to create session and if it fails to find a file it should simply return not to show the user message like "500 internal server error" Please help me on this that how can i efficiently write my exception to deal with this. Regards

Replies are listed 'Best First'.
Re: 500 internal server error !!
by moritz (Cardinal) on Aug 20, 2008 at 10:57 UTC
    Look at your servers error log, it should contain a better description than just "500".

    You can also try to run your script on the command line first and see how it behaves.

      moritz is correct, a simple perl -c <script|module> will find the root cause (syntax error, missing modules) for the majority (but not all) 500 errors.

      -derby
      my error log show /tmp/sess_xxxxxx..... line 30 in filename line 30 is the PHP::Session->new() .It is throwing this error when it is not able to create the session hence 500 internal server error is coming... There is nothing else i can count on i don't know perl is difficult in this case the in-built functions are not that smooth to handle such condition either my knowledge is restricted .... i need some way to check whether session is alive or not??? how one can do this ??? Please help me to come out of it. !!!!
        Maybe you want something like this:
        my $s = eval { PHP::Session->new() }; if ($s) { # I CAN HAZ SESSION } else { # there was an error }
        Is it perl or PHP ??
        []s, HTH, Massa (κς,πμ,πλ)
        Hey, easy with the bangs. Now, what is the "....."? It is the most important part of the error message...
        []s, HTH, Massa (κς,πμ,πλ)
Re: 500 internal server error !!
by massa (Hermit) on Aug 20, 2008 at 12:06 UTC
    Did you remember to use Error::TryCatch?? because if you didn't, you will have a syntax error...
    []s, HTH, Massa (κς,πμ,πλ)
Re: 500 internal server error !!
by pileofrogs (Priest) on Aug 20, 2008 at 17:26 UTC

    Okay, lets step back a step.

    First, does your code run when it's not on a web server? You need to find out if it even compiles first.

    Second, did you upload it in binary or ascii mode? If you uploaded from a Windows box to a unix box in binary mode, you'll get that error.

    Third, read the error logs as mentioned above.

    Fourth, use CGI::Carp with special attention to 'fatalsToBrowser'

    Once you have done all of these things, come back with your error in hand.

Re: 500 internal server error !!
by sasdrtx (Friar) on Aug 20, 2008 at 11:45 UTC
    What kind of Perl has try/catch? This looks like converted Java.

    sas

      Hi,

      It's using Error, which IMHO is not so nice module, even you have to be careful about the ';'.

      Regards,

      fmerges at irc.freenode.net

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2025-11-14 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (70 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.