php中使用IBM-DB2


编译php5中选择db2

./configure --prefix=/opt/php --with-apxs2=/opt/lib/apache2/bin/apxs --with-ibm-db2=/home/db2inst1/sqllib --enable-pdo --with-pdo-odbc=ibm-db2,/home/db2inst1/sqllib --with-mysql=/opt/mysql/ --with-mysqli=/opt/mysql/bin/mysql_config --with-pdo-mysql=/opt/mysql --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-pgsql=/opt/PostgreSQL/9.3 --with-pdo-pgsql=/opt/PostgreSQL/9.3 --with-gd --with-jpeg-dir=/usr --with-openssl-dir=/usr --with-zlib=/usr --enable-zip --with-pear


一、ibm_db2扩展库很简单,只有一条指令即可:

sudo /opt/php/bin/pecl install ibm_db2

中间需选择DB2的安装路径: /opt/ibm/db2/V10.5

安装成功后出现如下提示:

Libraries have been installed in:

   /tmp/pear/temp/pear-build-rootN8mu0l/ibm_db2-1.9.5/modules

Build process completed successfully

Installing '/opt/php/lib/php/extensions/no-debug-zts-20121212/ibm_db2.so'

install ok: channel://pecl.php.net/ibm_db2-1.9.5

configuration option "php_ini" is not set to php.ini location

You should add "extension=ibm_db2.so" to php.ini

按照提示把extension=ibm_db2.so 加到 php.ini


二、安装PDO_IBM扩展

1、去http://pecl.php.net/package/PDO_IBM 下载最新源代码

2、解压tar -xzvf PDO_IBM-1.3.1.tgz

3、cd PDO_IBM-1.3.3/

   并执行/opt/php/bin/phpize

4、在PDO_IBM-1.3.3目录下建立如下结构include/php/pdo/php_pdo

5、cp /opt/php/include/php/ext/pdo/* include/php/pdo/.

6、./configure --with-pdo-ibm=/home/db2inst1/sqllib

7、make 

8、sudo make install

9、extension=pdo_ibm.so 加到 php.ini


三、Restart Apache. 

  sudo service apache2 restart


你可能感兴趣的:(php中使用IBM-DB2)