Hi Ian,

You're right - I did actually copy just one of the iterations I've tried of apache config.

The parts of httpd.conf that I've added are:

## Load mod_perl
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlOptions +Parent
PerlSwitches -Mlib=/var/www/includes

<Location />
        DirectoryIndex index.pl index.html
        AddHandler perl-script .pl
        PerlResponseHandler ModPerl::Registry
        Options Indexes FollowSymLinks ExecCGI
        Require all granted
</Location>

This has the same symptoms however.

In this same configuration, changing the Handler from perl-script to cgi-script restores the expected behaviour...

On 13/5/24 19:14, Ian B wrote:
Not an expert here, so someone I'm sure will correct me if wrong!

Normally I'd expect an actual PerlHandler or similar included, eg PerlHandler ModPerl::Registry   or PerlHandler SomeLib::SomePAckage type thing...
(this would be as well as the Set/AddHandler line)

Kind regards,

On Mon, May 13, 2024 at 7:54 AM Steven Haigh via modperl <modperl@perl.apache.org <mailto:modperl@perl.apache.org>> wrote:

    Hi all,

    I'm playing around with mod_perl on apache on docker - and now I've
    finally got all the module issues sorted, I'm trying to figure out why
    when using mod_perl, the output of scripts ends up in the apache logs.

    The following configuration works, and the output of shelled scripts
    works as expected:

    <Location />
          DirectoryIndex index.pl <http://index.pl> index.html
          AddHandler cgi-script .pl
          Options +Indexes +FollowSymLinks +ExecCGI
          Require all granted
    </Location>

    If I change this to use mod_perl, all output from scripts run in web
    pages ends up in the apache log:

    <Location />
          DirectoryIndex index.pl <http://index.pl> index.html
          AddHandler perl-script .pl
          Options +Indexes +FollowSymLinks +ExecCGI
          Require all granted
    </Location>

    The perl code I'm using in the web page is as follows:
    my $cmd = "/bin/stdbuf";
    my @args = qw@ -o1 -e1 /usr/bin/speedtest-cli@;

    print '<pre class="alert">';
    my $pid = open3(0, \*READER, 0, $cmd, @args);
    while ( my $output = <READER> ) {
          print $output;
    }
    print "Speed test complete.</pre>";
    waitpid $pid,0;

    Does anyone have any clues as to why STDOUT would end up in the apache
    log and not in the web page being served when using perl-script as the
    handler?

-- Steven Haigh

    📧 net...@crc.id.au <mailto:net...@crc.id.au>
    💻 https://crc.id.au <https://crc.id.au>



--
Steven Haigh

📧 net...@crc.id.au
💻 https://crc.id.au

Reply via email to