PHP PECL PEAR: Installing php extensions such as db2 client.

Know that there are two approaches. Using PECL or statically compile the extensions. See towards the end of the document for a resolution and links to see the answer. The static approach uses the standard build system of unix that uses configure and make. Clearly the PECL approach is easier for newbies like me.

After all the research the bottom line answer is at this url

install ibm db2 client software first

what is php pear

Search for: what is php pear

what is pecl?

Search for: what is pecl?

home page of pear: http://pear.php.net/

Not entirely helpful for a beginer.

here is a better introduction to what pear is

The code in PEAR is partitioned in "packages". Each package is a separate project with its own development team, version number, release cycle, documentation and a defined relation to other packages (including dependencies). Packages are distributed as gzipped tar files with a description file inside, and installed on your local system using the PEAR installer.

All PEAR packages are registered in and downloaded from a central server at pear.php.net. Other third-party servers called "channels" also distribute packages that can be installed by the PEAR Installer, see the Channels list for more information. pear.php.net does not endorse the packages from these channels, and only provides support for packages distributed from pear.php.net.

Here is PECL home page

However PEAR installer can be used to manage maintain PECL extensions.

what is php-devel

Search for: what is php-devel

how to php install pear

Search for: how to php install pear

The base installation that comes with the PHP distribution contains all the stuff that is needed to run the PEAR installation tools etc. If you have a recent installation of PHP, you can relax: The PEAR base installation is already there - unless you have compiled your PHP with the ./configure flag --without-pear.

Manually installign PEAR


$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

pecl ibm_db2 package

Search for: pecl ibm_db2 package

here is the link to download if your firewall is blocking

or download the latest from here

when you install a pecl module you are compiling sources for that module. So if that module is dependent on other libraries you will prompted for their presense and their header files for completing the compilation process.

being a compile step you may also need a c compiler installed on such an OS.

php pdo ibm db2

Search for: php pdo ibm db2

setting up db2 for pdo an article from ibm docs

Read about: php ibm_db2 pdo_odbc

ibm_db2 is an extension written, maintained, and supported by IBM for access to DB2 databases. The ibm_db2 extension offers a procedural application programming interface (API) that, in addition to the normal create, read, update, and write database operations, also offers extensive access to the database metadata. You can compile the ibm_db2 extension with either PHP 4 or PHP 5.

PDO_ODBC is a driver for the PHP Data Objects (PDO) extension that offers access to DB2 databases through the standard object-oriented database interface introduced in PHP 5.1. Despite its name, you can compile the PDO_ODBC extension directly against the DB2 libraries to avoid the communications overhead and potential interference of an ODBC driver manager.

Here are specific instructions from IBM

pecl pdo_odbc install

Search for: pecl pdo_odbc install

download pdo_odbc driver

This extension provides an ODBC v3 driver for PDO. It supports unixODBC and IBM DB2 libraries, and will support more in future releases.

pdo_ibm pdo_odbc what is the difference

Search for: pdo_ibm pdo_odbc what is the difference

pdo_ibm.so

Search for: pdo_ibm.so

primary reference for pdo_ibm on PECL

pecl pdo_ibm download link

db2 and php best practices on ibm: pdf file


ibm_db2
pdo_ibm
pdo_odbc

unix linux what is configure command?

Search for: unix linux what is configure command?

here is an explanation of configure

what is config.m4 configure

Search for: what is config.m4 configure

The following link talks about how configure and php interacts with config.m4

pear and configure php

Search for: pear and configure php

a bit more clarification on the configure tool

this is a real good introduction to configure: pdf file


download zip file of a package
unzip it
go to root of that package
run ./configure
make
make install

where does pecl install the downloaded pecl pacakges? See here:

Then you need to change php.ini to enable the extension.

Alternatively here is how you can use php build system


Regenerate configure
statically compile your extensions into php
in this approach you will copy the extensions
  as a sub directory allowing the configure to work

More on m4 and php build system

whats up with gnu m4 macro processor