LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-22-2003, 09:54 PM   #1
rhuser
Member
 
Registered: Jan 2003
Posts: 55

Rep: Reputation: 15
my perl is not working, please help me


i have downloaded red hat 8 and selected Apache, Perl, PHP, mysql... all seems in order, but i am really getting frustrated with perl. i wrote a very basic script and it is not working. i try to test in a basic shell, and it worked when i try to run it on a browser on a client machine i just get the code printed, and it is not working. please please help me.

---
simply trying to test mod-perl

as perl came with the install of red hat, i simply went to httpd.conf and added the following

---->
PerlModule Apache::PerlRun
<Location /perl>
SetHandler perl-script
PerlHandler Apache::PerlRun
Options ExecCGI
PerlSendHeader On
allow from all
</Location>
<----

i created a file called mod_perl_rules1.pl

#! /usr/bin/perl
print "Content-type: text/plain\r\n\r\n";
print "mod_perl rules!\n";

when i try to run this in telnet i get

Content-type: text/plain

mod_perl rules!

but when i try to run it from the site i get an error message:

http://134.36.16.12/perl/mod_perl_rules1.pl


anyhelp would be appreciated. i have tried various other tutorials, but i am getting similar errors!
 
Old 02-22-2003, 11:09 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,108

Rep: Reputation: 64
Re: my perl is not working, please help me

Quote:
Originally posted by rhuser

#! /usr/bin/perl
print "Content-type: text/plain\r\n\r\n";
print "mod_perl rules!\n";
Change the second line to read:

print "Content-type: text/plain\n\n";

I think that'll fix it. At least that's what the perl CGI code that I've written looks like... and it works.

Hope this helped,

Rick
 
Old 02-22-2003, 11:16 PM   #3
rhuser
Member
 
Registered: Jan 2003
Posts: 55

Original Poster
Rep: Reputation: 15
Re: Rick

Thank you for your comment

i tried, this is what i got

http://134.36.16.12/perl/mod_perl_rules1.pl


do u have MSN Messanger, i will try to explain the problem further please.
 
Old 02-22-2003, 11:36 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,108

Rep: Reputation: 64
Re: Re: Rick

Quote:
Originally posted by rhuser
Thank you for your comment

i tried, this is what i got

http://134.36.16.12/perl/mod_perl_rules1.pl
Was I supposed to see the ``Internal Server Error'' message? That error message rings a bell. I haven't written any CGI for some time now so you'll have to forgive me. It'll take some time for me to get rid of all these cobwebs.

Have you tried using printf() instead of print()? IIRC, print() automatically appends a newline. That might be a problem.

Do any CGI programs work? Where does this CGI program live and have you configured the httpd server to allow programs to run out of that directory?
Quote:

do u have MSN Messanger, i will try to explain the problem further please.
Me? On MSN? That's rich. Sorry, we'll have to work it out here.
 
Old 02-24-2003, 10:30 AM   #5
rhuser
Member
 
Registered: Jan 2003
Posts: 55

Original Poster
Rep: Reputation: 15
thanks for the help.

I am a newbie to this liunx and perl so do excecuse me if i ask silly questions!

when i load the page, i just get the file printed, no output. so i dont think if i try other print commands i wiill be suceesull. have a look at the page.
http://134.36.16.12/mod_perl_rules1.pl

do i need any CGI programs to work PERL? i have simply downloaded a custom copy of RH8 with Apache Mysql, Perl, PHP.... and i have downloaded nothing since.

Do i need some kind of a Perl Interprator to download!!!! please help me.
 
Old 02-24-2003, 04:55 PM   #6
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,108

Rep: Reputation: 64
Similar problem...

Quote:
Originally posted by rhuser
do i need any CGI programs to work PERL? i have simply downloaded a custom copy of RH8 with Apache Mysql, Perl, PHP.... and i have downloaded nothing since.
What sort of customized RH8 did you download? And from where?
Quote:

Do i need some kind of a Perl Interprator to download!!!! please help me.
No.

Your problem sounds very, very similar to another one that I've been attempting to help out with. You're running your cgi script out of a user's public_html directory, no? If not, let me know.

And I'm betting that if you stick a copy of that very same script in /var/www/cgi-bin that it'll work. Try it and see.

I haven't used that ``<Location /perl>'' construct in httpd.conf. I'll have to take a look at that.
 
Old 02-24-2003, 08:21 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,108

Rep: Reputation: 64
Quote:
Originally posted by rhuser
when i load the page, i just get the file printed, no output
Oops! I just saw your ourput page and noticed the syntax error. Your script:
Code:
#! /usr/bin/perl -w
print "Content-type: text/plain\r\n\r\n";
print "mod_perl rules!\n";
should not have a space between the ``!'' and the ``/'' (in line one).
 
Old 03-14-2003, 02:12 PM   #8
mapage
LQ Newbie
 
Registered: Mar 2003
Posts: 3

Rep: Reputation: 0
I had the exact same problem. Around line 800 in the httpd.conf you should see a line that looks like this
#AddHandler cgi-script .cgi
Take out the # , restart the httpd server (service httpd restart) and it should work. If your cgi script has a .pl extenstion, you may have to add .pl to the list after the .cgi in the above line. Hope this helps.

- Matt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cant get perl working with apache2 Garda Linux - Networking 1 09-28-2005 11:27 PM
perl 5.87 debugger not working techy613 Linux - Software 0 08-08-2005 03:54 PM
perl not working again!!! dsgdevil Linux - Software 19 07-15-2003 07:45 PM
cant get perl working dsgdevil Linux - Software 2 02-12-2003 09:18 PM
Perl>>working with strings format_c Programming 2 11-15-2001 05:21 PM


All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration