LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2004, 08:36 AM   #1
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Rep: Reputation: 0
Installing CGI


Hi,

I just installed RedHat 9 about 2 days ago and don't think I've done too badly, considering I'm a newbie. I've got a samber and apache running pretty quick.

Now, I want my server (the computer I'm talkin about) to display CGI files. When I type url-here.com/cgi-bin/file.cgi I get a "Page cannot be displayed error". Does this mean I need to install ActivePerl? If so, I've downloaded ActivePerl, where do I go from here? I installed ActivePerl when I had my win2k server, which was reasonably simple since it's mostly GUI.

Can anyone tell me how to install ActivePerl on RedHat 9, or, does anyone have any simple language tutorials I can look at?

Thanks in advanced.

Oh, btw, it's weird, because PHP works on my server fine and I didn't even attempt to install that.

Last edited by immolate; 06-27-2004 at 08:38 AM.
 
Old 06-27-2004, 08:54 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
I doubt if you need active perl. Do you get an error number ie "500 server error"?

What are the permissions on the file? Is it executable by the apache user?

You may get more information from the apache error_log file.
 
Old 06-27-2004, 09:28 AM   #3
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
Checked the error log, it says:

[Sun Jul 27 21:51:52 2004] [error] [client xxx.xx.0.2] script not found or unable to stat: /var/www/cgi-bin/gm.cgi
 
Old 06-27-2004, 09:40 AM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Can you post the output from:
ls -l /var/www/cgi-bin
 
Old 06-27-2004, 05:18 PM   #5
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
Sure thing..

total 700
-rw-rw-rw- 1 moor moor 52 Jun 27 16:44 gm-authors.cgi
-rw-r--r-- 1 moor moor 23 Jun 27 16:43 gm-banlist.cgi
-rw-r--r-- 1 moor moor 7275 Jun 27 16:28 gm.cgi
-rw-r--r-- 1 moor moor 19127 Jun 27 16:25 gm-comments.cgi
-rw-r--r-- 1 moor moor 400 Jun 27 16:43 gm-config.cgi
-rw-r--r-- 1 moor moor 16 Jun 27 19:33 gm-counter.cgi
-rw-r--r-- 1 moor moor 3859 Jun 27 19:33 gm-cplog.cgi
-rw-r--r-- 1 moor moor 37 Jun 27 16:44 gm-entrylist.cgi
-rw-r--r-- 1 moor moor 10295 Jun 27 16:25 gm-karma.cgi
-rw-r--r-- 1 moor moor 606982 Jun 27 16:28 gm-library.cgi
-rw-r--r-- 1 moor moor 22522 Jun 27 19:33 gm-templates.cgi
-rw-r--r-- 1 moor moor 9162 Jun 27 16:28 gm-upload.cgi
 
Old 06-27-2004, 05:22 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You will need to set the execute bit so that apache can run the files - try either:
chmod -R 755 /var/www/cgi-bin

Or for more security:
chmod -R 750 /var/www/cgi-bin
chgrp -R apache /var/www/cgi-bin

That assumes that apache is running as apache and not another user.
 
Old 06-27-2004, 05:29 PM   #7
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
Still not working.
 
Old 06-27-2004, 05:31 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Is it the same error in the error_log? Can you post the output from:
ls -la /var/www/cgi-bin
ps -ef | grep apache
 
Old 06-27-2004, 05:31 PM   #9
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
Do you get an error number ie "500 server error"?

Yes I do, sorry, I missed that before.
 
Old 06-27-2004, 05:42 PM   #10
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
ls -la /var/www/cgi-bin:

total 708
drwxr-xr-x 2 root root 4096 Jun 28 07:29 .
drwxrwxrwx 9 root root 4096 Jun 27 23:37 ..
-rwxr-xr-x 1 moor apache 52 Jun 27 16:44 gm-authors.cgi
-rwxr-xr-x 1 moor apache 23 Jun 27 16:43 gm-banlist.cgi
-rwxr-xr-x 1 moor apache 7275 Jun 27 16:28 gm.cgi
-rwxr-xr-x 1 moor apache 19127 Jun 27 16:25 gm-comments.cgi
-rwxr-xr-x 1 moor apache 400 Jun 27 16:43 gm-config.cgi
-rwxr-xr-x 1 moor apache 16 Jun 27 19:33 gm-counter.cgi
-rwxr-xr-x 1 moor apache 3859 Jun 27 19:33 gm-cplog.cgi
-rwxr-xr-x 1 moor apache 37 Jun 27 16:44 gm-entrylist.cgi
-rwxr-xr-x 1 moor apache 10295 Jun 27 16:25 gm-karma.cgi
-rwxr-xr-x 1 moor apache 606982 Jun 27 16:28 gm-library.cgi
-rwxr-xr-x 1 moor apache 22522 Jun 27 19:33 gm-templates.cgi
-rwxr-xr-x 1 moor apache 9162 Jun 27 16:28 gm-upload.cgi

ps -ef | grep apache:

apache 2789 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2790 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2791 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2792 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2793 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2794 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2795 2152 0 Jun27 ? 00:00:00 [httpd]
apache 2796 2152 0 Jun27 ? 00:00:00 [httpd]
root 8375 2101 0 07:40 pts/0 00:00:00 grep apache

and I'm getting this error in error log:

Mon Jun 28 07:32:00 2004] [error] [client 203.18.0.2] Premature end of script headers: gm.cgi
[Mon Jun 28 07:32:00 2004] [error] [client 203.18.0.2] Can't locate CGI/Carp.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at /var/www/cgi-bin/gm.cgi line 18.
[Mon Jun 28 07:32:00 2004] [error] [client 203.18.0.2] BEGIN failed--compilation aborted at /var/www/cgi-bin/gm.cgi line 18.
 
Old 06-27-2004, 06:05 PM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Well you are getting there The scripts are now being run but is looking for "CGI/Carp.pm" perl module which is not on your system. You should be able to install it with CPAN:
perl -eshell -MCPAN

If this is the first time you have used it you will need to go through the config - the defaults should be fine. Then install Carp with:
install CGI::Carp
 
Old 06-27-2004, 06:28 PM   #12
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
I typed perl -eshell -MCPAN and got the following:

Can't locate CPAN.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thr
ead-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-
multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/ven
dor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib
/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5
.8.0 .).

Last edited by immolate; 06-27-2004 at 08:00 PM.
 
Old 06-27-2004, 06:39 PM   #13
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Welll you can either install cpan which will make it easier to install perl modules in the future or just install the Carp module manually. Either way you can get the source from:
http://www.cpan.org
 
Old 06-27-2004, 07:57 PM   #14
immolate
LQ Newbie
 
Registered: Jun 2004
Location: Sydney, Australia
Distribution: Redhat
Posts: 19

Original Poster
Rep: Reputation: 0
Ok, I'll do that when I get home in about 5 hours. :P

I'm a little confused though, what do I exactly have to do? I'm very sorry, my newbness is taking over me.

Last edited by immolate; 06-27-2004 at 08:01 PM.
 
Old 06-27-2004, 10:24 PM   #15
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
You need to do exactly what david_ross told you to do. What is happening is that Apache is trying to execute your CGI script. It is not able to do so, however, because a Perl module that your script uses is not installed on your system. When you launch the CPAN shell (which is what perl -MCPAN -eshell does) you will be given a prompt. You can then type the install command that david_ross gave you, which will download and install that module. This may seem strange if you're unfamiliar with Perl, but it'll become more familiar with time.
 
  


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
installing cgi perl to get lynx working hypnotiks Linux - Newbie 1 12-19-2004 03:06 PM
Help on installing Speedy CGI on FC2 john_drayton Fedora 0 10-01-2004 05:53 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 09:49 PM
Trouble installing CGI scripts shaggystyle Linux - Networking 7 01-13-2004 03:38 PM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 08:35 AM


All times are GMT -5. The time now is 05:47 PM.

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