develooper Front page | perl.php.sandwich.dev | Postings from November 2005

Re: PHP::Interpreter for mere mortals

Thread Previous | Thread Next
From:
George Schlossnagle
Date:
November 10, 2005 08:51
Subject:
Re: PHP::Interpreter for mere mortals
Message ID:
43737A80.7070409@omniti.com
Geoffrey Young wrote:

>>The PHP SAPIs (excluding CLI) are mutually exclusive.
>>    
>>
>
>oooh!
>
>ok, so I got rid of the -with-apxs foo to compile the embedded php and
>installed it.  most of the tests pass now.
>
>coolio, installed.
>
>now, as a layperlson who is php-illiterate I'm finding that I can't quite
>use it in php-land.  taken from the example in Interpreter.pm
>
>  $ cat foo.php
>  <?php
>    $perl = Perl::getInstance();
>  ?>
>  $ php foo.php
>
>  Fatal error: Class 'Perl' not found in /src/PHP-Interpreter-1.0.1/foo.php
>on line 2
>
>I mean, this should eventually work, right?  or am I not thinking about the
>module in the right way?
>
>for the interested, here's where I'm headed...
>
>I'm trying to write a library that wraps some Apache-Test classes (like
>Apache::TestRequest and HTTP::Response) into a php library.  the end result
>is that the following code ought to work
>
>  <?php
>    require "test-more.php";
>    require "apache-test.php";
>
>    # note we didn't need a host or port in that URL.  that's why
>    # I'm doing this.
>    $response = GET('/admin', array('X-Test-Header' => 'one'));
>
>    is ($response->code,
>        200,
>        'got back 200 - yippie!');
>
>    # yum - HTTP::Response goodness in php!
>    diag($response->as_string);
>  ?>
>
>right now apache-test.php looks like this
>
>  <?php
>    $perl = Perl::getInstance();
>
>    $perl->eval("use Apache::Test");
>    $perl->eval("use Apache::TestRequest");
>
>    function GET($uri, $headers)
>    {
>      return $perl->call('GET', $uri, $headers);
>    }
>  ?>
>
>so, I should at least be close once I figure out exactly how to get
>PHP::Interpreter actually working in PHP land :)
>
>but now for the hard part...
>
>if I read your above comment right the embeded php and httpd php module are
>mutually exclusive.  because this is Apache-Test, I'm going to eventually
>need to have
>
>  - a CLI that supports PHP::Interpreter
>  - a libphp5.so loaded into httpd as mod_php5 (PHP::Interpreter support not
>necessary)
>
>so, ideas on how to compile php so that the two can easily exist on the same
>server?  I'm going to need to be explicit about how to do this in the A-T
>docs at some point, but I'll happily patch the PHP::Interpreter README when
>I figure it all out :)
>  
>


The sandwich is Perl->PHP->Perl->..., not PHP->Perl->PHP->... (at least 
currently).  So you need to start in Perl. 

George



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About