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 |
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”). |
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.
|
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 |
/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'" |
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? |
try:
perl -v which perl |
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? |
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 |
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. |