"Hello World!" not working

A

Admin

Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but it's
not working. I tried it on 3 different servers and I always get "Internal
Server Error". Here's the script:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "hello world.\n\n";

The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
extension. The script is in the cgi-bin folder. The file has 755
permissions. What is wrong?
 
G

Gunnar Hjalmarsson

Admin said:
Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
it's not working. I tried it on 3 different servers and I always get
"Internal Server Error". Here's the script:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "hello world.\n\n";

The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
extension. The script is in the cgi-bin folder. The file has 755
permissions. What is wrong?

Maybe you uploaded it from a Windows box to a *nix server in binary
mode. Try ASCII transfer mode instead.

Another thing you can try is adding a switch to the shebang line, e.g.

#!/usr/bin/perl -w
 
S

Shane

Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but it's
not working. I tried it on 3 different servers and I always get "Internal
Server Error". Here's the script:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "hello world.\n\n";

The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
extension. The script is in the cgi-bin folder. The file has 755
permissions. What is wrong?

is cgi-bin/printenv working?
if not, have a look at apaches httpd.conf
 
A

A. Sinan Unur

Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
it's not working. I tried it on 3 different servers and I always get
"Internal Server Error". Here's the script:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "hello world.\n\n";

The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
extension. The script is in the cgi-bin folder. The file has 755
permissions. What is wrong?

Who knows?

What did you see when you checked the error log?

Oh, and, why are you lying about the content type?

Sinan
 
S

Sherm Pendley

Admin said:
Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
it's not working. I tried it on 3 different servers and I always get
"Internal Server Error". Here's the script:

Have you read (and followed) the advice in the Perl FAQ?

perl -q 500

There are two very useful links in there.

sherm--
 
B

Big and Blue

Admin said:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";

So, you say you're going to send HTML, but then...
print "hello world.\n\n";

...you sedn ordinary text (ie: text/plain).

You don't just have a Perl problem here.

PS: I'm convinced I made a similar reply to a similar post about a month
ago. Ah, yes. That was from "NullBlock". Only difference was (s)he
spelt "Hello, World." correctly (but you've both omintted the !).

So, has "NullBlock" been promoted to "admin"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top