Radio_Head

Well-Known Member
Verifed Vendor
Feb 15, 2002
2,048
1
343
When I run this simple perl script from web....

#!/usr/bin/perl
open(SENDMAIL, &|/usr/sbin/sendmail -t -odi&) or die &error: $!\n&;
print SENDMAIL &&&EOF&;
From: TestFrom &info\@domain.com&
To: test &test\@domain.com&
Subject: mail test
test
eof
close (SENDMAIL) or die &sendmail didn't close nicely&;
exit;


... I receive an internal server error (however I receive the Email) .
If I execute above script from command line it works fine , no error . Why ? Thanks
 

SHSaeed

Well-Known Member
May 9, 2002
243
0
316
Your script is not printing anything to the browser, not even sending a header..

Try adding..

print &Content-type: text/html\n\n&;
print &Hello World&;

to the bottom (before the exit;)..
 

gorgo

Well-Known Member
Jan 9, 2002
148
0
316
with perl scripts, it's end task is to display something... when your web browser requests the page, it asks for something back. Since the Perl script has nothing to display to the web browser, it just crashes out like you showed...

So just remember, perl must ALWAYS have a content-type, and must always output something when a browser calls ;)
 

Radio_Head

Well-Known Member
Verifed Vendor
Feb 15, 2002
2,048
1
343
[quote:82344361e7][i:82344361e7]Originally posted by (SH)Saeed[/i:82344361e7]

Your script is not printing anything to the browser, not even sending a header..

Try adding..

print &Content-type: text/html\n\n&;
print &Hello World&;

to the bottom (before the exit;)..[/quote:82344361e7]

Hello ,

Thank you ( I am a php lover ;) )...

however I added

print &Content-type: text/html\n\n&;
print &Hello World&;

to the bottom (before the exit..

but I am still receiving an Internal server error , using the browser ... (no error from command line) ..


Thank you
 

Radio_Head

Well-Known Member
Verifed Vendor
Feb 15, 2002
2,048
1
343
ok now works ;)

Now , I am trying to execute a cron job on it but it doesn't work.
Perhaps because there are anti spam restrictions ?