Mar 26

PHP and perl are two very popular Web programming languages. They both have many libraries and extensions that can simplify the process of development, but often you can find a perl library you want, and not the corresponding library in PHP. (Perl is older then PHP, so naturally it has a larger selection of libraries and extensions.) This was the main reason that the perl extension for PHP was written.

Installation

download the php perl  extention

# cd /root

# wget http://pecl.php.net/get/perl-1.0.0.tgz

# tar -xvf perl-1.0.0.tgz

# cd perl-1.0.0

you can read the README for detail installation on /root/perl-1.0.0

======================================================================================

Requirements

============

PHP 5.0.0RC2 or later

Perl 5.8.0 or later
Quick install

=============
Step 1. Compile this extension. PHP_PREFIX and PERL_PREFIX mast point to

real

PHP and Perl instalation prefixes.
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
Step 2. Install the extension (this step can require root privileges)
make install
Step 3. Add perl extension into your php.ini (this step can require root

privileges)
extension=perl.so

======================================================================================
I assume you have installed the php and perl, youc an use yast / zypper to do that

# php -v
PHP 5.3.1 (cli)

#rpm -qa | grep perl
perl-5.10.0-72.5.i586

you can search php  prefix path by using whereis

# whereis php
php: /usr//local/bin/php /usr/share/man/man1/php.1.gz

# export PHP_PREFIX=”/usr/local”
# export PERL_PREFIX=”/usr”
# $PHP_PREFIX/bin/phpize
# ./configure –with-perl=$PERL_PREFIX
–with-php-config=$PHP_PREFIX/bin/php-config
# make

you will find this error :

/root/perl-1.0.0/php_perl.c:172: warning: initialization from
incompatible pointer type
/root/perl-1.0.0/php_perl.c:173: warning: initialization from
incompatible pointer type
/root/perl-1.0.0/php_perl.c:199: warning: initialization from
incompatible pointer type
/root/perl-1.0.0/php_perl.c:200: warning: initialization from
incompatible pointer type
/root/perl-1.0.0/php_perl.c: In function âphp_perl_zval_to_sv_refâ:
/root/perl-1.0.0/php_perl.c:343: error: ‘zval’ has no member named ‘is_ref’

/root/perl-1.0.0/php_perl.c:1779: warning: assignment from incompatible
pointer type
make: *** [php_perl.lo] Error 1

Solution :

– it turns out the php_perl wasn’t compatible with the php 5.3

–  you need to go to http://svn.php.net/viewvc/pecl/perl/trunk/ -> click php_perl.c -> then click download (http://svn.php.net/viewvc/pecl/perl/trunk/php_perl.c?revision=289243&view=co)

– just wget http://svn.php.net/viewvc/pecl/perl/trunk/php_perl.c?revision=289243&view=co

– you will get php_perl.c\?revision\=289243 just rename it to php_perl.c then paste it to /root/perl-1.0.0/ then

#cd /root/perl-1.0.0
#/usr/local/bin/phpize
#./configure –with-perl=/usr/bin/perl –with-php-config=/usr/local/bin/php-config
#make
#make install

– Edit php.ini
#vim /usr/local/lib/php.ini
– add this line

extension=perl.so

– Restart the apache
#/usr/local/apache2/bin/apachectl stop
#/usr/local/apache2/bin/apachectl start

– Check your phpinfo
http:/localhost/phpinfo.php

perl

Aug 08

What is openssl php extension ?

Php module that  uses the functions of » OpenSSL for generation and verification of signatures and for sealing (encrypting) and opening (decrypting) data.

System requirement

  • – Apache2
  • – Php
  • – OpenSSL

Setup

In this tutorial i have already installed Apache2 and Php 5.2.5 . I just need to add OpenSSL module on my php i also decided to upgrade my php from 5.2.5 to 5.2.9. First you need to download the Php (http://us.php.net/downloads.php) and Openssl sourcode (http://www.openssl.org/source/)

#wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
#wget http://us.php.net/distributions/php-5.2.9.tar.gz

Extract and compile the openssl

#cd /root
#tar -zxvf openssl-0.9.8k.tar.gz
#cd openssl-0.9.8k
#./config && make && make install

Extract, configure and installed the php

Before you configure the php sourcecode you must remember the previous php configuration right ? if not you can use php -i |grep configure to see the previous configuration

# php -i |grep configure
Configure Command =>  ‘./configure’  ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-mysql=/usr/local/mysql’ ‘–with-gd=/usr/local’ ‘–with-jpeg-dir=/usr/local/lib’ ‘–with-zlib-dir=/usr/local’ ‘–with-ftp’ ‘–with-gif’ ‘–enable-ftp’ ‘–with-png-dir=/usr/local/lib’ ‘–with-freetype-dir=/usr/local’ ‘–with-curl=/usr/local’

Now you have the config list, start the php installation

#cd /root
#tar -zxvf php-5.2.9.tar.gz
#cd php-5.2.9
./configure –with-openssl=/usr/local/ssl  –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –with-gd=/usr/local –with-jpeg-dir=/usr/local/lib –with-zlib-dir=/usr/local –with-ftp –with-gif –enable-ftp –with-png-dir=/usr/local/lib –with-freetype-dir=/usr/local –with-curl=/usr/local

#make
#make install

And the last thing don’t forget to restart your apache2

#/usr/local/apache2/bin/apachectl stop

#/usr/local/apache2/bin/apachectl start

Now check your openssl module

# php -m | grep openssl
openssl
if you see openssl it means you did it