Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Help with error 500, but compiles and runs on my server and syntex checks out

Reply
Thread Tools

Help with error 500, but compiles and runs on my server and syntex checks out

 
 
froil
Guest
Posts: n/a
 
      03-08-2006
When i run this on my box it works fine. no errors, but when i upload
it to the server, it keeps giving me error 500 premature end of script.

i know that most likely it is some stupid little mistake, but i have
looked over this for hours and can't find it. Seems to complie and run
#!/usr/bin/perl
#newpage.cgi
use warnings;
use strict;
use DBI;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $username = '?';
my $password = '?';
my $data_source = 'DBI:mysql:jilesfr_pictures:69.6.255.192:3306';
Print_Html_Top();
Get_Descriptions();
Print_Html_Bottom();
sub Print_Row{
my $rec = shift;
my $currentpage = $rec->{currentpages};
print qq(<tr><td><input type=radio name=pagename
value=$currentpage>$currentpage</td></tr>);
}
sub Get_Descriptions{
my $DBH = DBI->connect( $data_source, $username, $password )
or die "Error: $DBI::errstr\n";
my $sth_fetch=
$DBH->prepare( qq(SELECT * FROM pages)) or die
$DBH->errstr;
$sth_fetch->execute();
while( my $ptr = $sth_fetch->fetchrow_hashref){
Print_Row($ptr);
}
}
sub Print_Html_Top{
print header;
print<<EOT;
<html><head><title>Add Files</title></head>
<body>
<Form name="upload" Method="Post"
Action="/cgi-bin/uploadeasy1.cgi" Enctype="multipart/form-data">
<center><h2>Add Pictures</h2></center>
<center><font size=3>Select page to add to, or type in
name of new page</font></center>
<center><Table Border=1>
<tr><td>New Page Name: </td>
<td><input type="text" name="newpage"></td></tr>
EOT
}
sub Print_Html_Bottom {
print<<EOT;
<tr>
<td>Choose File: </td>
<td><input type="file" Name="filename"></td>
</tr>
<tr>
<td>Description: </td>
<td><input type="text" Name="description" rows="1"
cols="40"></td></tr>
<tr><td><input type="submit" Name="submit" Value="Save
File"></td></tr></table></center>
</form>
</body></html>
EOT
}

 
Reply With Quote
 
 
 
 
Big and Blue
Guest
Posts: n/a
 
      03-08-2006
froil wrote:
> When i run this on my box it works fine. no errors, but when i upload
> it to the server, it keeps giving me error 500 premature end of script.


So what does the error log of the Web server say?

You have a lot of die()s in there that are never going to send any info
back to a Web client. Have you considered writing a kill_me function to
actually format an actual HTML page containing the error text (so that you
don't even need to read the logs) and installing it as $SIG{_DIE_}?

--
Just because I've written it doesn't mean that
either you or I have to believe it.
 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      03-08-2006
Big and Blue <> wrote:

> You have a lot of die()s in there that are never going to send any
> info
> back to a Web client. Have you considered writing a kill_me function
> to actually format an actual HTML page containing the error text (so
> that you don't even need to read the logs) and installing it as
> $SIG{_DIE_}?


Maybe you should find out what

use CGI::Carp qw(fatalsToBrowser);

does?

Personally I would put it above all other non-pragmatic use's.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
I ploink googlegroups.com

 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      03-08-2006
froil wrote:
> When i run this on my box it works fine. no errors, but when i upload
> it to the server, it keeps giving me error 500 premature end of script.


Why did you repeat that question in a new thread instead of following up
the reply you received?

http://groups.google.com/group/comp....b82a0b947d9e48

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      03-08-2006
froil wrote:
> When i run this on my box it works fine. no errors, but when i upload
> it to the server, it keeps giving me error 500 premature end of
> script.


So, why don't you follow the advice in the FAQ ('perldoc -q 500'):

"My CGI script runs from the command line but not the browser. (500
Server Error)"

jue


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SYNTEX ERROR in C# ghufran Software 0 07-28-2008 01:54 PM
How do I add exception-handling to this code and make sure it compiles and runs properly? robinsand@gmail.com C++ 4 06-20-2006 09:13 PM
friend ostream& operator <<, compiles and runs in Dev++ no output or error in Borland Rock C++ 4 11-20-2005 06:26 AM
client script syntex error Nikhil Patel ASP .Net 1 10-07-2004 03:39 PM
jEdit: compiles JDK 1.5.0 ok, but runs JDK 1.4.1 (why?) Thomas G. Marshall Java 5 08-06-2004 04:12 AM



Advertisments