Re: unable to load perl extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, December 29, 2005 9:17 am, dev lamp wrote:
> I am unable to call perl code from PHP, since the extension does not
> get loaded !
>
> Scenario 1:
> use dl('perl.so'); in the php code and invoke the script from the
> command line
> The script works fine and the perl code gets executed as well.
>
> Scenario 2:
> the perl extension does not get loaded and the PHP script crashes.

Define "crashes"...

Does it literally crash the PHP/Apache process, or does it just print
out "Not loaded"?

Either way, crank up your error settings to E_ALL and check your
Apache error log to find out *WHY* it's not getting loaded.

Could you live with:
<?php
  exec("/usr/local/bin/perl script.pl", $output, $error);
  $output = implode("<br />\n", $output);
  if ($error) die("OS Error: $error<br />\n$output");
  echo $output; //probably do something more interesting here
?>

> I have read the article
> http://www.zend.com/php5/articles/php5-perl.php
>
> If anybody has faced this issue, please share how you solved the
> problem ?
>
> Thanks in advance.
> ----
> Here are the environment Details:
> RHEL 4.0
> PHP 5.0.5 (self compiled)
> PECL/PERL package checked out from CVS
>
> PHP 5.0.5 compilation details
> ---------------------------
> ./configure  --with-apxs2=/usr/local/apache2/bin/apxs
> --with-mysql=/usr/bin/mysql_config
> --with-mysqli=/usr/bin/mysql_config --with-openssl-dir=/usr/local/ssl
> --with-libxml-dir=/usr/lib --enable-soap --enable-sockets
> --enable-sqlite-utf8  --enable-wddx --with-gnu-ld  --with-gd
> --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib
> --with-zlib-dir=/usr/local/lib --with-gd=/usr/local
> --enable-gd-native-ttf --enable-maintainer-zts  --with-pear
> make
> make install
>
>
> pecl/perl package compilation details
> -------------------------
> export PHP_PREFIX="/usr/local"
> export PERL_PREFIX="/usr"
> echo $PHP_PREFIX
> echo $PERL_PREFIX
> $PHP_PREFIX/bin/phpize
> ./configure --with-perl=$PERL_PREFIX
> --with-php-config=$PHP_PREFIX/bin/php-config
> make
> make install
>
> entries in php.ini file
> --------------
>
> extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20041030/"
> extension=perl.so
>
>
> sample test code is as follows -
> <?php
> if (!extension_loaded('perl'))
> {
>    print "perl extension not loaded";
>    exit;
> }
> ?>
>
> --
> Dev.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux