LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Perl on debian question (https://www.linuxquestions.org/questions/linux-newbie-8/perl-on-debian-question-415150/)

CompleteNoob 02-13-2006 10:31 PM

Perl on debian question
 
Hey guys. Just setup a LAMP server (apache2, php5, mysql5). Heres my question. Can I setup apache2 to run perl scripts from the htdocs folder? and how do I know if perl is even working? Im assuming it came with debian.

Thanks in advance.

gilead 02-13-2006 10:37 PM

perl -v will tell you if it's there and what version it is.

The ScriptAlias directive tells Apache that everything in a directory is a script and not a document. That's probably not exactly what you need - can you put the scripts in a sub-directory of the document directory?

CompleteNoob 02-13-2006 10:46 PM

Thanks for the quick response. If I use the cgi-bin do I have to redirect there? eg. http://localhost/cgi-bin/foo.cgi?

gilead 02-13-2006 11:12 PM

Actually, a simpler way to do it might be with the AddHandler directive. It allows specific files within a location to be marked as scripts. For example, in my Bugzilla setup I have the following to allow CGI scripts to be executed:
Code:

Alias /bugzilla /usr/local/bugzilla-2.20
<Directory /usr/local/bugzilla-2.20>
  AddHandler cgi-script .cgi
  Options +Indexes +ExecCGI +FollowSymLinks
  DirectoryIndex index.cgi
  AllowOverride Limit
  Order allow,deny
  Allow from all
</Directory>


CompleteNoob 02-15-2006 08:52 PM

OK, forgive the stupidity of this question but I'm not understanding. In my "htdocs" folder, I have my index page. However, I want to be able to run perl scripts in these pages. The cgi-bin folder is not in the htdocs folder, so to redirect a user there how do I do this? or is the cgi-bin supposed to be in htdocs?

gilead 02-15-2006 09:03 PM

It's not a stupid question - I shouldn't have suggested the ScriptAlias directive in my first post. If you use the AddHandler command for the directory that your scripts live in, you can run the scripts without moving them to a cgi-bin directory.

Depending how curious you are, you can download Bugzilla from http://ftp.mozilla.org/pub/mozilla.o...la-2.20.tar.gz, extract it and see that they have a variety of scripts in their setup. But with the AddHandler directive set up the way I have it in my earlier post, only the .cgi files can be executed, not the .pl files.

You'd just use the suffix (.pl, .cgi, etc.) that suited your environment.


All times are GMT -5. The time now is 11:35 PM.