andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
The environment is as follows:
I downloaded this package and compiled as follows:$ perl -v | grep built This is perl, v5.8.5 built for i386-linux-thread-multi $ php -v | grep built PHP 5.1.6 (cli) (built: Jun 17 2007 11:44:56)
Then I did a added extension=perl.so to /etc/php.ini:export PHP_PREFIX="/usr" export PERL_PREFIX="/usr" $PHP_PREFIX/bin/phpize ./configure --with-perl=$PERL_PREFIX --with-php-config=$PHP_PREFIX/bin +/php-config make sudo make install
The shared perl library seems to be in place:$ grep -i extension /etc/php.ini | grep -v '^;' extension_dir = "/usr/lib/php/modules" extension=perl.so
But when I try to run this simple sample, I get the error below:$ ll /usr/lib/php/modules/ | grep perl -rwxr-xr-x 1 root root 150234 May 6 08:56 perl.so
Has anyone succeeded interfacing perl from php using the above approach?$ cat perl.php <?php $perl = Perl::getInstance(); ?> $ php perl.php PHP Fatal error: Call to undefined method Perl::getinstance() in perl.php on line 2
(Note that I also tried PHP::Interpreter without success. make test reports PHP/Interpreter/Interpreter.so: undefined symbol: _zval_ptr_dtor).
Update (RESOLVED): I made a mistake when copying sample code, as kindly noted by moritz:
$ cat call.perl.from.php <?php #$perl = Perl::getInstance(); $perl = new Perl(); $perl->eval(" print \"Executing Perl code in PHP\n\" "); ?> $ php call.perl.from.php Executing Perl code in PHP
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using Perl Code from PHP
by moritz (Cardinal) on May 06, 2008 at 09:01 UTC | |
by andreas1234567 (Vicar) on May 06, 2008 at 09:28 UTC | |
by Akaber (Initiate) on Jun 09, 2008 at 12:19 UTC | |
by andreas1234567 (Vicar) on Jun 09, 2008 at 12:44 UTC |