IBM DB2 Installation
From DreamFactory
Notes
Using DB2 with PHP requires the installation of 2 drivers, ibm_db2, and pdo_ibm. The following instructions are intended as a guide. Knowledge of compiling applications is necessary for this process.
Linux
Debian/Ubuntu/Mint/Etc
IBM_DB2
- Get the prerequisites
- <source lang=bash>$ sudo apt-get install build-essential php5-dev php-pear ksh zip</source>
- Download the DS Driver package from IBM (login required, free.) https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsdpds
- Extract the DS Driver package to a directory of your choosing. I made a directory in /opt/ibm for this, and will use this directory throughout the examples.
- <source lang=bash>$ sudo mkdir /opt/ibm</source>
- <source lang=bash>$ sudo tar -zxvf ibm_data_server_driver_package_linuxx64_v10.5.tar.gz -C /opt/ibm</source>
- Change directory to the extracted files and make the installer executable
- <source lang=bash>$ cd /opt/ibm/dsdriver</source>
- <source lang=bash>$ sudo chmod +x installDriver</source>
- Install the DS Driver package
- <source lang=bash>$ sudo ksh installDriver</source>
- You should see feed back on the screen indicating successful installation. If you do not, please troubleshoot and resolve before proceeding
- Build and install the module with PECL. The installer will ask you for the DB2 Installation Directory, which will be /opt/ibm/dsdriver
- <source lang=bash>$ sudo pecl install ibm_db2</source>
- <source lang=bash>DB2 Installation Directory? : /opt/ibm/dsdriver</source>
- Enable the module in PHP
- Use your text editor of choice (I use vim) to add an ibm_db2.ini file
- <source lang=bash>$ sudo vim /etc/php5/mods-available/ibm_db2.ini</source>
- The file should have a single line
- <source lang=bash>extension=ibm_db2.so</source>
- Save the file. Then enable the module the php enmod
- <source lang=bash>$ sudo php5enmod ibm_db2</source>
- Confirm installed and working in PHP
- <source lang=bash>$ php -m</source>
- You should not see any errors at the top of the module list, and ibm_db2 should be in the module list.