ultranerds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to work out how to disable mod_perl for JUST SOME files/a folder.

I have used the following to disable mod_perl on other servers:
<Directory /srv/www/foo.pro/www/cgi-bin/trust/admin> SetHandler cgi-script AddHandler cgi-script .cgi </Directory> <FilesMatch "(user)\.(cgi)$"> SetHandler cgi-script AddHandler cgi-script .cgi </FilesMatch>


Here is the full host entry in Apache:
<Virtualhost *:8181> LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so ServerName foo DocumentRoot /srv/www/foo.pro/www ErrorLog /srv/www/foo.pro/logs/error.log PerlRequire /srv/www/foo.pro/startup.pl PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlModule Apache2::RequestRec <Directory "/srv/www/foo.pro/www"> Options MultiViews FollowSymLinks AllowOverride all Require all granted </Directory> ScriptAlias /cgi-bin /srv/www/foo.pro/www/cgi-bin <Location /cgi-bin> SetHandler perl-script AddHandler perl-script .cgi PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch AllowOverride All Require all granted </Location> <Location /> LimitRequestBody 5242880 </Location> <Directory /srv/www/foo.pro/www/cgi-bin/trust/admin> SetHandler cgi-script AddHandler cgi-script .cgi </Directory> <FilesMatch "(user)\.(cgi)$"> SetHandler cgi-script AddHandler cgi-script .cgi </FilesMatch> </VirtualHost>


My software is:

Server version: Apache/2.4.25 (Ubuntu) Server built: 2016-12-21T09:13:44 mod_perl: 2.000010

I don't understand why it still insists on running all the scripts under mod_perl (I need to disable the admin one, otherwise we get some caching... and user.cgi I need to disable, as it seems like mod_perl breaks sendmail!)

Thanks in advance

Andy

Replies are listed 'Best First'.
Re: Disabling mod_perl on some files / folder?
by Corion (Patriarch) on Apr 06, 2017 at 10:50 UTC

    If you don't want mod_perl to apply to a file, don't name the file .cgi.

    I don't think that mod_perl breaks sendmail, but maybe sendmail cannot be started from the user your webserver resp. script runs under.

    Also, consider simply using MIME::Lite or Net::SMTP.

      Thanks. Maybe I will look into Net::SMTP. I'm only using sendmail as it's the built in method of this script, and I really don't want to have to re-write all it's emailing functions just to make it work on mod_perl.