Re: [ap2/mp2] post-processing handler output with another module (php)

[prev] [thread] [next] [Date index for 2005/03/13]

From: Matthew Westcott
Subject: Re: [ap2/mp2] post-processing handler output with another module (php)
Date: 15:26 on 13 Mar 2005
On 13 Mar 2005, at 14:20, John ORourke wrote:

> Hi,
>
> I'm sure I should know this, but I'm trying to post-process the output 
> of my
> handler with PHP.  I'm still a bit green on Apache inner workings and 
> just
> can't make it happen.

Just to be clear - your mod_perl handler is outputting PHP source which 
you then hope to feed to PHP? If so, I don't think it's possible 
directly - PHP can only be invoked as a response handler which reads 
the script from the filesystem, and there can only be one response 
handler in use. That said, I have two suggestions of varying hairiness:

1. Make your mod_perl handler a PerlFixupHandler (or any appropriate 
earlier stage) which writes the PHP script to a file, and then set up 
PHP as the response handler:
$r->handler('php-script');
You may need to tinker with other response fields to avoid PHP getting 
confused, such as re-statting the file:
my $finfo = APR::Finfo::stat($filename, APR::FINFO_NORM, $r->pool());
$r->finfo($finfo);

2. Forget about using the PHP Apache module; pipe the output of your 
PerlResponseHandler through the command-line PHP interpreter instead.

- Matthew

Re: [ap2/mp2] post-processing handler output with another module (php)
Matthew Westcott 15:26 on 13 Mar 2005

Generated at 08:54 on 14 Mar 2005 by mariachi v0.52