: Let apache run perlscripts that don't have an extension I'd like to use perlscripts without their extension. f.e. "index" instead of "index.pl". Changing the DefaultType-directive from text/plain
I'd like to use perlscripts without their extension. f.e. "index" instead of "index.pl".
Changing the DefaultType-directive from text/plain to application/x-perl didn't do the trick. Instead of running the script the server offered to download its source.
I'm not exactly sure if changing this directive is the right approach. Telling apache to read the shebang-line when there is no extension sounds much better to me.
I hope someone with more experience on this topic can help me out.
More posts by @Angie530
2 Comments
Sorted by latest first Latest Oldest Best
It all really depends on how did you write your Perl script (which framework, which style) and how do you invoke them (CGI, FastCGI, mod_perl, PSGI, HTTP reverse proxy, etc.) but usually every Apache handler that you add per file extension you can also add based on a directory or location.
For good examples on different ways of deploying Perl scripts on Apache using the Catalyst Web framework see: wiki.catalystframework.org/wiki/deployment#Apache
For examples on how to deploy Perl scripts using the Mojo framework see: github.com/kraih/mojo/wiki/Apache-deployment
If you use CGI then your scripts will be run by perl as long as they are executable and have something like #!/usr/local/bin/perl in the hashbang line but it's not really recommended to use CGI any more, unless you understand the performance issues.
If you use ModPerl::Registry you can use a config like this example:
# httpd.conf
PerlModule ModPerl::Registry
Alias /perl/ /home/httpd/perl/
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
#PerlOptions +ParseHeaders
#PerlOptions -GlobalRequest
Options +ExecCGI
</Location>
and have everything in /perl be interpreted as Perl script and run by mod_perl.
If you use PSGI or directly HTTP with a reverse proxy, you have to configure Apache to proxy everything from some location to your application using HTTP.
There are really too many ways to do it to enumerate every one of them not knowing your configuration.
You have to use rewrite to map scripts without a name to their perl equivalent.
For example EXAMPLE.COM/mypage would map to mypage.pl. (where example.com is the site your domain)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.