php中使用IBM-DB2


編譯php5中選擇db2php

./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-pearmysql


1、ibm_db2擴展庫很簡單,只有一條指令便可:sql

sudo /opt/php/bin/pecl install ibm_db2apache

中間需選擇DB2的安裝路徑: /opt/ibm/db2/V10.5ui

安裝成功後出現以下提示:.net

Libraries have been installed in:debug

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

Build process completed successfullyip

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

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


2、安裝PDO_IBM擴展

一、去http://pecl.php.net/package/PDO_IBM 下載最新源代碼

二、解壓tar -xzvf PDO_IBM-1.3.1.tgz

三、cd PDO_IBM-1.3.3/

   並執行/opt/php/bin/phpize

四、在PDO_IBM-1.3.3目錄下創建以下結構include/php/pdo/php_pdo

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

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

七、make 

八、sudo make install

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


3、Restart Apache. 

  sudo service apache2 restart

相關文章
相關標籤/搜索