Hi,
I'm using Mason to dynamically create templated web-pages and this is all working okay, adding headers/footers/menus etc... via the autohandler and "$m->call_next" for the content.
However, I also have a number of inherited PHP scripts, the output of which I'd also like to format using my Mason components. Now, when I access those .php scripts, I get a download dialog pop-up stating that we have an unrecognised mime type etc... Ok. That's because the php is "application/x-httpd-php" rather than "text/html". (The PHP is processed okay if I add an appropriate FilesMatch/SetHandler directive for those .php files, but obviously doesn't do the Mason formatting stuff)
So, I've created a module "Apache::PHP" which uses the Apache::SubProcess module to exec the command "php -f $r->filename". This Apache::PHP is then chained to the Mason Handler, the idea being that I could parse the file using Apache::PHP, output the html to Mason which then does the wizzy formatting stuff and ta-da!. Sounds feasible I thought, but when parsing the PHP in the child process, I get a Segmentation fault... yeuch!. My guess is that somewhere within Apache there's a limit to the amount of memory a request can grab, and, in spawning php, this limit is exceeded. So, does anyone have any ideas how I can either work around this, i.e. alternatives to spawn system commands from a request, or increase the amount of memory that a request can use... All links, suggestions welcome.
That sounds feasible, but not practical, as you bring the performance down to nada by calling a bunch of external processes. You are much better off looking at Apache2/mod_perl2 where you can use filters to parse the output of various handlers. I'm not sure though, how easy it is to convert Mason to act as a filter. For information on filters, see:
http://perl.apache.org/docs/2.0/user/handlers/filters.html
In mod_perl 1, you could try using Apache::Filter http://search.cpan.org/dist/Apache-Filter/
but it's probably going to be much slower and more memory consuming because of the buffering.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html