CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Might be Basic questions : sendmail and connecting to mySQL via DBI

 



Merlin
journeyman

Sep 24, 2000, 12:15 PM

Post #1 of 6 (746 views)
Might be Basic questions : sendmail and connecting to mySQL via DBI Can't Post

Ok, two things :
1-) Trying to do basic sendmail but the server is ALWAYS giving me an internal error. Server is Linux running Apache 1.3. The mini-script :
#!/usr/bin/perl
open (MAIL, "|/usr/sbin/sendmail -t") | | &erreur;
print MAIL "To: me\@mymail.com\nFrom: someone\@theirmail.com\n";
print MAIL "Subject:test!\n";
print MAIL "Message\n";
close (MAIL);

print "Content-type:text/html\n\n";
print "ok!";

sub erreur {
print "Content-type:text/html\n\n";
print "Erreur Sendmail!\n";
}
Nothing works with this... I tried changing the filehandle, with or without the pipe, removing all print MAIL statements, etc. Any help or comments about syntax highly appreciated.
2-) I'm running a web site that's on secure and non-secure servers. Both Linux with Apache, running mySQL 3.22.32, CGI, DBI, DBD::mysql. The trouble is that on one, my command to connect to my database works fine but the same one on the secure server gives me an error. The connection statement :
use CGI; use DBI;
$dbh = DBI->connect('dbi:mysql:boulangerie:amidala.iweb-hosting.com','username','password');
I know the problem's there since the script runs fine on the secure server if I just remove the connect statement (no internal server error). Any help? Thanks in advance... I'm a bit rushed here since the contract I'm doing is a bit overdue... Wink


Kanji
User

Sep 24, 2000, 4:19 PM

Post #2 of 6 (746 views)
Re: Might be Basic questions : sendmail and connecting to mySQL via DBI [In reply to] Can't Post

Check your server error logs. They'll tell you what's wrong or at least give you clues.

If you don't have access to your logs, place ...

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use CGI::Carp 'fatalsToBrowser';</pre><HR></BLOCKQUOTE>

... near the top of your script so that errors go to the browser instead of that pesky -- and unhelpful -- SERVER ERROR.


Kanji
User

Sep 24, 2000, 4:22 PM

Post #3 of 6 (746 views)
Re: Might be Basic questions : sendmail and connecting to mySQL via DBI [In reply to] Can't Post

Oh, on your mail issue ... you need TWO newlines between header and message, otherwise they're all assumed to be headers.


Merlin
journeyman

Sep 24, 2000, 5:41 PM

Post #4 of 6 (746 views)
Re: Might be Basic questions : sendmail and connecting to mySQL via DBI [In reply to] Can't Post

Thanks so much, I just solved the part about sendmail. And the tip for more descriptive error messages will be extremely helpful. I was just saying to my provider how lame the error messages where but this will definitely be a big plus. Thanks again! Smile


Merlin
journeyman

Sep 25, 2000, 4:38 AM

Post #5 of 6 (746 views)
Re: Might be Basic questions : sendmail and connecting to mySQL via DBI [In reply to] Can't Post

mmmmhhh... I tried your use CGI::Carp 'fatalsToBrowser'; in a script of mine and I keep getting the same ol' internal error instead of more details. Know what this could be about? Thanks!


Merlin
journeyman

Sep 26, 2000, 6:32 AM

Post #6 of 6 (746 views)
Re: Might be Basic questions : sendmail and connecting to mySQL via DBI [In reply to] Can't Post

The CGI function now works! I'm REALLY living in the twilight zone now... (working,not working,working,not working...) Thanks!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives