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

Desert coder

Does anyone know how to blend SSI Perl (.shtml) with PHP?
From what I understand, the extension is read to determine how the HTML will be processed (.php3/.php for PHP, and .shtml for SSI Perl), so my question is..

if I want to incorporate both into my website design, which extension do I use, or is there a special tag that can be placed in the HTML file instead? Thanks, Perl has become a gateway drug :)

Replies are listed 'Best First'.
Re: Marrying PHP and Perl together
by bjelli (Pilgrim) on Mar 26, 2001 at 22:42 UTC

    From New features in Apache 2.0:

    Filtering
    Apache modules may now be written as filters which act on the stream of content as it is delivered to or from the server. This allows, for example, the output of CGI scripts to be parsed for Server Side Include directive by mod_include.

    There's more on Filters in the Apache 2 Documentation.

    I haven't used this stuff, just heard about it at Apachecon Europe. Apache 2 is still alpha.

    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at
Re: Marrying PHP and Perl together
by wardk (Deacon) on Mar 26, 2001 at 21:42 UTC

    one method would be to use a .php file along with a PHP exec() call to the perl code.

    <? echo exec( "/some/Perl/That/outputssometing" ); ?>
      Desert coder Thanks! It works :)
Re: Marrying PHP and Perl together
by arturo (Vicar) on Mar 26, 2001 at 21:43 UTC

    I don't think you can without serious acrobatics, if at all; Apache (which I assume you're using) allows you to define different handlers for certain kinds of files, and while you can chain handlers together under mod_perl, the logistics are bound to be incredibly hairy.

    Let's push the question back a stage. PHP is very powerful, almost as powerful as Perl; it is certainly far more powerful than server-side includes. What is it that you can't do with pure PHP that you would want to do in Perl SSI (or,catering to the present audience, vice-versa) ?

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor