I have a customized templating system I wrote to do language translations using mod_perl to filter every page using xml files for the words. It works well, and I even figured out how to make it handle server-side includes such as embedded php.

However, it appears that anytime my mod_perl running as a Apache::Filter handler runs the PHP it has a disturbing tendency to create little PHP zombies that never go away until the http server gets too many of them and then has to be restarted.

Here is the relevant code:

if($content =~ /\<\?php (.*?)\?\>/s) { $scrap = $1 . "\n"; $ENV{REDIRECT_STATUS} = "dummy status"; $ENV{REDIRECT_URL} = $ENV{SCRIPT_URI}; $ENV{REDIRECT_URI} = $ENV{SCRIPT_URI}; $ENV{REDIRECT_QUERY_STRING} = $ENV{QUERY_STRING}; open2(\*PHPOUT,\*PHPIN,"php -q 2>&1") or log_error("Rotary::Transl +ations: Unable to open php pipe. Reason: $!\n"); print PHPIN $scrap; close(PHPIN); my $line; while($line = <PHPOUT>) { if( $line eq "Content-type: text/html\n") { next; } $newcontent .= $line; } close(PHPOUT); $content = ""; }

I do close the pipe, so what more do I need to do to make it release the zombie?


In reply to Perl Web Zombie problem by bivansc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.