LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2004, 07:56 AM   #1
davidk
LQ Newbie
 
Registered: Sep 2004
Location: Adelaide Australia
Posts: 14

Rep: Reputation: 0
cgi won't work in apache


Hi,
I have an apache server running three virtual hosts. I am trying to put a counter on one of the pages but it doesn't seem to run. It is supposed to use gif images but I don't get anything on the page. I have used the instructions on this page:
http://aitech.ac.jp/~inomoto/ino/cgi/counter2.htm

I know the file perl@ is where it should be. I have .htaccess in the folder where the html file is. I have the counter.cgi script in both a subdirectory of the website and the cgi folder in apache dir.

I have added Options +ExecCGI to the httpd.conf file.

I am not getting any errors in the log file to say it can't find the cgi file.

I have made the permissions accessible for all for the cgi folders and the folder with the pictures.

It just seems as though the cgi script isn't running and I don't know where to look next. Can anyone point me in the right direction?

thanks
David K
 
Old 10-14-2004, 11:11 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Check that the script itself is executable; does it run from the command-line? (It may not do anything useful in that context, but BASH should not give you any error messages).

Also, make sure that the directories where the script is are readable and executable by the user that apache runs as (usually “nobody”).
 
Old 10-14-2004, 07:54 PM   #3
MikeZila
Member
 
Registered: Jul 2004
Location: Parts Unknown
Distribution: Arch
Posts: 377

Rep: Reputation: 30
You should also make sure that if your scripts have "#!" (pronounced "sharp bang") lines at the top, that they point toward their respective CGI interpreters.
 
Old 10-15-2004, 03:34 AM   #4
davidk
LQ Newbie
 
Registered: Sep 2004
Location: Adelaide Australia
Posts: 14

Original Poster
Rep: Reputation: 0
hi,
Thanks but these are already the case. the top of the file says #!/etc/local/perl and there is a file called perl@ in the location #!/etc/local/

how can I test that the file I am looking at /usr/local/perl@ is actually a working interpreter. its the only one I can find on my computer.

thanks
David K

Last edited by davidk; 10-15-2004 at 03:39 AM.
 
Old 10-15-2004, 03:58 AM   #5
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
/etc/local/perl and /etc/local/perl@ are different files. The script wants /etc/local/perl. The #! should point to an executable file that is a perl interpreter.
To test if it works, try something like
Code:
/etc/local/perl -e "print 'This is Perl'"
 
Old 10-15-2004, 06:03 AM   #6
davidk
LQ Newbie
 
Registered: Sep 2004
Location: Adelaide Australia
Posts: 14

Original Poster
Rep: Reputation: 0
hmm that didn't work (as you said)
so did it not get installed with my installation? I am sure I had it installed. how can I check?
do I download it from somewhere and re-install it?
 
Old 10-15-2004, 06:43 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
try:
perl -v
which perl
 
Old 10-15-2004, 09:53 AM   #8
davidk
LQ Newbie
 
Registered: Sep 2004
Location: Adelaide Australia
Posts: 14

Original Poster
Rep: Reputation: 0
it looks like its there. it said :
This is perl v5.8.0 built for 1386-linux-thread-multi
...
...


so why would it be saying
: bad interpreter: No such file or directory

te first line of the cgi file is :
#!/usr/perl

and perl is in /usr

should I re-install perl?
 
Old 10-15-2004, 06:44 PM   #9
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Don't reinstall Perl. You have a Perl that's working well enough to tell you it's version. Where is it?
Set the correct location in the #! line in the CGI script.

#!/usr/bin/perl is quite common.

Alternativly, create a symlink to it in /etc/local:
Code:
cd /etc/local
cp -s /usr/bin/perl .
 
Old 10-16-2004, 07:09 AM   #10
MikeZila
Member
 
Registered: Jul 2004
Location: Parts Unknown
Distribution: Arch
Posts: 377

Rep: Reputation: 30
Also, make sure you're point at Perl's execuable, not its directory.
 
  


Reply



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
Getting CGI to work in apache jon_k Linux - Software 4 11-13-2004 04:06 PM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 08:49 PM
Apache And CGI bmh.01 Linux - Software 2 05-31-2003 11:52 AM
apache v2.0.44 + cgi ; securing cgi-support in apache markus1982 Linux - General 0 01-20-2003 01:03 PM
CGI program not work in Apache Manuel Tejada Linux - General 3 10-31-2002 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:01 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