View previous topic :: View next topic |
Author |
Message |
equinox_black -
Joined: 18 Aug 2005 Posts: 30
|
Posted: Wed Aug 24, 2005 6:05 am Post subject: I have mastered the 500 internal server error!!!! HA! |
|
|
I feel very accomplished right now....
I was getting 500 internal server errors... so i brought up the log... it looked like this...
"-T" is on the #! line, it must also be used on the command line at first.cgi line 1.
CGI: [D:\DungeonMaster\perl\bin\perl.exe first.cgi ] URI: /first.cgi Broken pipe
my shebang line looked like this.... #!c:/perl/bin/perl -wT because i was trying to use the warnings flag and the special user input taint...... well that was the problem! it wasn't supported on my server, deleted the -wT and guess what! my scripts are working!!!!
So just as a heads up to anyone out there.... make sure your shebang is precise... you can list the drive, since i use my d: drive as a space dedicated to web development, i put every thing there, but installing perl there didnt work, so i put it on the c: drive....
I think i'm going to go smoke a cigarette now. |
|
Back to top |
|
|
equinox_black -
Joined: 18 Aug 2005 Posts: 30
|
Posted: Wed Aug 24, 2005 6:46 am Post subject: |
|
|
ok, ok... so i get back fom my cig.... i'm down with qbasic, vb 6.0, and a bit of java.... never touched perl in my life... so i said to myself... i'm gonna make a guest book..... so in the time it took me to make that last post... smoke, and come back in and write it, i came up with this....
CGI SCRIPT:
#!c:/perl/bin/perl
use CGI qw(:standard);
print header;
print start_html("thanks");
print <<StartHtml;
Thanks for your input. Click this link to
<a href="/guestbook.htm">return to the guestbook.</a>
StartHtml
print end_html;
open(GUEST,">>guestbook.txt");
my @values = split(/&/,$ENV{QUERY_STRING});
foreach my $i (@values) {
my($fieldname, $data) = split(/=/, $i);
print GUEST "$fieldname = $data";
}
close(GUEST);
HTML FORM:
<html><head><title>guestbook</title></head>
<body>
<form action="/cgi-bin/guestbook.cgi/" method="get">
Comments:<br><textarea name="comments" cols="50" rows="4"></textarea><br>
Email:<input type="text" name ="email" size="40">
<input type="submit" value="Submit">
</form>
</body>
</html>
check it out on my site! its hot! dmonline.sytes.net |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Aug 24, 2005 12:44 pm Post subject: Re: I have mastered the 500 internal server error!!!! HA! |
|
|
equinox_black wrote: | "-T" is on the #! line, it must also be used on the command line at first.cgi line 1.
|
All you have to do is to add -wT to the Arguments field in the Perl Interpreter declaration dialog in Abyss Web Server. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
cyber_gremlin -
Joined: 13 Aug 2005 Posts: 9
|
Posted: Wed Aug 24, 2005 1:21 pm Post subject: I had the 500 error too |
|
|
Hi I had the 500 error and I found that it was a problem with the dbi module...
I have fixed the problem...well almost and my scripts run when i click my submit button on my form however when I go to mysql nothing changes.. no data is put in to the table.
Please help.
My code looks like this...
$query = new CGI;
print $query->header();
print $query->start_html();
$datasource = 'DBI:mysql:database=myDb;host=localhost';
$user = 'myUser';
$pass = 'myPass';
$dbh = DBI->connect($datasource, $user, $pass) or die "Couldn't connect\n";
print $query->h2("in the database");
$name = $query->param('firstname');
$surname = $query->param('lastname');
$email = $query->param('email');
$sql = qq{INSERT INTO formtest(firstname,lastname,email,)
VALUES('$name','$surname','$email')}; |
|
Back to top |
|
|
equinox_black -
Joined: 18 Aug 2005 Posts: 30
|
Posted: Wed Aug 24, 2005 4:39 pm Post subject: |
|
|
sorry man, that is out of my league. databases and i have never gotten along to well. |
|
Back to top |
|
|
equinox_black -
Joined: 18 Aug 2005 Posts: 30
|
Posted: Wed Aug 24, 2005 7:00 pm Post subject: |
|
|
actully, now that i'm looking over it.... where are you passing the query string??? i think you have to have the $ENV{QUERY_STRING} somewhere in there..... and i dont think i see it, yeah... i dont see how your information would get from the form to your script.... as long as your submit button has the submit type, and your form has the post method you can use the environment varialbe QUERY_STRING then you have to parse it out and write it to your database... give this a try...
http://www.cgi101.com/learn/ch3/text.html
if i'm completly off base, sorry... |
|
Back to top |
|
|
Immemiaplaype -
Joined: 13 Jul 2011 Posts: 13 Location: United Kingdom
|
Posted: Thu Dec 15, 2011 5:30 am Post subject: I have mastered the 500 internal server error HA |
|
|
Only A Hobo, How did you end up fixing the problem? |
|
Back to top |
|
|
|