LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-10-2003, 12:54 PM   #1
mylo2003
Member
 
Registered: Jul 2003
Posts: 113

Rep: Reputation: 15
Cant run CGI scripts on Apache!


Hi all,

I'm having a little difficulty running CGI scripts on my apache server w/ linux.

I have done the following already through some google searches.

In the httpd.conf file I have:
added AddHandler cgi-script .cgi
ensured that the ScriptAlias /cgi-bin/ is the correct path.
Changed Options Indexes FollowSymLinks MultiViews to:
Options Indexes FollowSymLinks MultiViews ExecCGI Includes

I have ensured that the rights are all given (is there a for sure way of doing this...I went to the cgi-bin dir and chmod 777 *.cgi - i hope thats enough!!!???)

The error message I get through apache's logs is

Sun Aug 10 13:46:15 2003] [error] [client 127.0.0.1] Can't locate DBI.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/dbi.cgi line 42.

Any clue???
 
Old 08-10-2003, 01:47 PM   #2
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Any file that has the mime type application/x-httpd-cgi or handler cgi-script (Apache 1.1 or later) will be treated as a CGI script, and run by the server, with its output being returned to the client. Files acquire this type either by having a name containing an extension defined by the AddType directive, or by being in a ScriptAlias directory. Files that are not in a ScriptAlias directory, but which are of type application/x-httpd-cgi by virtue of an AddType directive, will still not be executed by the server unless Options ExecCGI is enabled. See the Options directive for more details.
When the server invokes a CGI script, it will add a variable called DOCUMENT_ROOT to the environment. This variable will contain the value of the DocumentRoot configuration variable.

Debugging CGI scripts has traditionally been difficult, mainly because it has not been possible to study the output (standard output and error) for scripts which are failing to run properly. These directives, included in Apache 1.2 and later, provide more detailed logging of errors when they occur.

Try:

1) Trailing slash on the path of <Directory> and DocumentRoot is a syntax error but not strict enough to prompt you for error.

2) How did you configure mod_perl? Via URI or extension? You only have AddHandler cgi-script .cgi and no .pl. But the .pl were giving you the troubles.

3) Instead of CGI::Carp you can use ScriptLog to see more verbose errors.

4) Change the LogLevel and see if there is any error code in your log.

5) If you composed your script in Windows, try to use a better editor (i.e. UltraEdit) than notepad/wordpad and trim all trailing space and convert to UNIX format on exit.
 
Old 08-10-2003, 03:53 PM   #3
mylo2003
Member
 
Registered: Jul 2003
Posts: 113

Original Poster
Rep: Reputation: 15
Ths is awesome advice. Thank you so much btw.
I added .pl as well...I never put that in here but I did do that.

I just realized that I don't have any "loadmodules' that load Perl. I think i have to configure that. This might be my problem. How do I configure mod_perl?
 
Old 08-10-2003, 04:47 PM   #4
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Hey you, try this limk to configure your mod_perl

http://perl.apache.org/docs/1.0/guid...ration_in_Perl

help works..

waiting...
 
Old 08-22-2003, 10:37 AM   #5
mylo2003
Member
 
Registered: Jul 2003
Posts: 113

Original Poster
Rep: Reputation: 15
Hey man,

Thx a lot for your help. I must say that i am still tackling this unfortunatley. That mod_perl setup was too exhaustive for me. Is all this really necessary to run cgi/perl scripts? Is there a simpler link?
 
Old 11-09-2004, 09:22 AM   #6
David Mann
LQ Newbie
 
Registered: Sep 2004
Posts: 5

Rep: Reputation: 0
I'm getting exactly the same error in Fedora 1, Apache 2 running Perl 5.8.1 with DBI to connect to MySQL 4.1.

Can't help you yet. Just thought you might like to know you're not alone.

When I ran the versions originally installed with the Fedora 1 distribution I eventually got MySQL and Perl running on Apache. In that situation I found it helpful to comment out everything in the mod_perl configuration file. I can't remember where it is but it was called something like mod_perl.conf. Then I could only be using the external perl installed on Fedora. However, I only got the error as you've described when I upgraded to newer versions so I'm still flummoxed.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
does apache support cgi scripts and how to run them abhis_mail2002 Fedora 3 03-15-2005 04:37 AM
Apache 2.0.43 will not run cgi scripts RobbieRoy Linux - Networking 5 09-04-2003 02:56 PM
Can windows run CGI Scripts? mylo2003 Linux - General 5 08-28-2003 03:07 PM
Apache cgi scripts! boyinfrance Linux - Newbie 2 06-22-2002 10:33 PM
cant run cgi scripts jmdey Linux - Networking 1 01-07-2002 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:25 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
Open Source Consulting | Domain Registration