If you really want to write your own webserver, you could do worse than taking a look at HTTP::Server::Simple or HTTP::Server::Brick for inspiration.

There does not seem to be firewall modules on CPAN, but there is a module called Hook::Filter which builds a "firewall" around subroutines and has a rule-based set-up with the rules found in a configuration file. Again you can "steal" probably some techniques from this module.

Not being a PHP-person, I guess that you will somehow have to call the PHP interpreter with the PHP-file as an argument. It does seem possible to run a PHP program outside of a web-server: Stand-alone PHP.

Update: Some more info on how to use PHP "stand-alone" is in this article:PHP Standalone Scripts. If the PHP-interpreter is in your PATH it could be as simple as: my $return_code = system('php my_standalone_script.php');

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re: Perl - webserver by CountZero
in thread Perl - webserver by -=Mizo=-

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.