[PHP] how to call perl code from PHP

2005-12-29 Thread dev lamp
Hi

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.

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 -


--
Dev.

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



[PHP] unable to load perl extension

2005-12-29 Thread dev lamp
Hi

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.

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 -


--
Dev.

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



Re: [PHP] unable to load perl extension

2005-12-29 Thread dev lamp
On 12/29/05, Jochem Maas <[EMAIL PROTECTED]> wrote:
> dev lamp wrote:
> > Hi
> >
> > 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.
>
> so the extension is not being loaded automatically right?
> but if you dl() it everything is fine, right?
> then double check the 'right' ini file is being used!
>

There is only one php.ini
I have checked the extensions path information using phpinfo().

Is there something else that I need to checkout ?

> >
>
> is the apache module using the php.ini that you think it is ?? -
> that kind of thing has caught me out more than once!
>
> >

How do I check that ?
I downloaded apache sources and compiled it.
Why do I need to specify the path of the php.ini file to the apache web server ?


Dev.

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



[PHP] ternary operator in heredoc string

2005-12-31 Thread dev lamp
Hi

I am trying to use the ternary operator inside heredoc string
to select the bgcolor based on the flag value, but it
does not seem to work.

$summary=<<

$reqno


STR;

I looked up php documentation but could not find any details.

What would be an optimal way to write the code for the above situation ?

thanks
Dev.

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



Re: [PHP] unable to load perl extension

2005-12-31 Thread dev lamp
On 12/31/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Thu, December 29, 2005 9:17 am, dev lamp wrote:
> > 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"?
>

It just prints "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:
>exec("/usr/local/bin/perl script.pl", $output, $error);
>   $output = implode("\n", $output);
>   if ($error) die("OS Error: $error\n$output");
>   echo $output; //probably do something more interesting here
> ?>
>

Well, I would like to avoid this, since the PERL objects have to be used
and want to invoke methods.

thanks for your time.

thanks
Dev.

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