This looks very interesting… should be helpful in getting me more acquainted with perl. To install on Lenny, I first installed php5-dev, but unfortunately that still didn’t do it. Looks like this module needs the –embed option set in the php interpreter to be used. Going to have to hold of on this to install it on a testing environment rather than a development machine.
Now I’m trying to get PHP installed in such a way I can use it… I tried getting the perl makefile to use the php headers installed by debian, but it wants to look in /usr/local/*. Hmmm.
UPDATE: I was able to get this going.
* php-5.2.6
* ./configure –enable-embed=shared –enable-maintainer-zts
* make
* make install
That put the new php into /usr/local. Then I installed PHP::Interpreter manually after trying to get it via CPAN, which didn’t happen. When I tried to use it, I got complaints about Exporter, so I added that as a use include, and it worked! Getting it to work with mod_perl and even as a regular cgi-bin file was challenging, but I got it to go:
CGI
#!/usr/bin/perl
use Exporter;
use PHP::Interpreter;
print "Content-Type: text/html\n\n";
my $php = PHP::Interpreter->new();
my $old_hander = $php->set_output_handler(\$scalar);
my $output = $php->eval(q^ phpinfo(); ^);
my $outbuf = $php->get_output;
print $outbuf;
mod_perl
sub handler {
my $r = shift;
my $php = PHP::Interpreter->new();
my $scalar;
my $old_hander = $php->set_output_handler(\$scalar);
my $output = $php->eval(q^ phpinfo(); ^);
my $outbuf = $php->get_output;
$r->print($outbuf);
return Apache2::Const::OK;
}
Why bother doing this? The novelty of it is pretty good by itself!
Next up, a more challenging configuration setup:
--enable-embed=shared \
--enable-maintainer-zts \
--disable-rpath \
--disable-static \
--with-pic \
--with-pear=/usr/share/php \
--enable-calendar \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-bcmath \
--with-bz2 \
--enable-ctype \
--without-gdbm \
--with-iconv \
--enable-ftp \
--with-gettext \
--enable-mbstring \
--enable-shmop \
--enable-sockets \
--enable-wddx \
--with-libxml-dir=/usr \
--with-xsl=/usr \
--with-zlib \
--with-openssl=/usr \
--enable-zip
The Server API Ham and Cheese ?
External Links
cpan.org/dist/PHP-Interpreter/lib/PHP/Interpreter.pm
http://www.perlmonks.org/?node_id=612502
http://search.cpan.org/src/GSCHLOSS/PHP-Interpreter-1.0.1/README
do you mean you have a success result with PHP::Interpreter ?
I 70ta - yeh - I did get it to work successfully. Its a really interesting idea, don’t you think?
Yeah , i know its good idea
but i faced a lot of failed steps when i install it , do you mind if you tell me what is the way that you followed to install it ?
Are you on Debian?
iam on Centos 4
Hmmm, well I’m not too sure on how to work on Cent OS, but what have you tried so far? Maybe I can help if I understand your specific problem better. Have you downloaded the php src?
Yes i tried it several times , visit more than 10 Sites that talk about PHP::Interpreter and no succes result , i tomorow i will try to compile php without apache becuz some thread on the net say may be i want to compile php without apache :S
Hi 7ota - yeah try that. I use fastcgi instead of PHP as an apache module…