develooper Front page | | Postings from November 2005

Re: PHP::Interpreter for mere mortals

Thread Previous | Thread Next
Geoffrey Young
November 10, 2005 08:45
Re: PHP::Interpreter for mere mortals
Message ID:

> The PHP SAPIs (excluding CLI) are mutually exclusive.


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

  $ cat foo.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

    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,
        'got back 200 - yippie!');

    # yum - HTTP::Response goodness in php!

right now apache-test.php looks like this

    $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 loaded into httpd as mod_php5 (PHP::Interpreter support not

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 :)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About