LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   cgi won't work in apache (https://www.linuxquestions.org/questions/linux-networking-3/cgi-wont-work-in-apache-242533/)

davidk 10-14-2004 07:56 AM

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

rjlee 10-14-2004 11:11 AM

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”).

MikeZila 10-14-2004 07:54 PM

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.

davidk 10-15-2004 03:34 AM

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

rjlee 10-15-2004 03:58 AM

/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'"

davidk 10-15-2004 06:03 AM

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?

bathory 10-15-2004 06:43 AM

try:
perl -v
which perl

davidk 10-15-2004 09:53 AM

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?

rjlee 10-15-2004 06:44 PM

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 .


MikeZila 10-16-2004 07:09 AM

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


All times are GMT -5. The time now is 02:59 PM.