DB2, Linux and PHP

If you want to use DB2 as a back end database for PHP, then you have to do the following.

If you have not allready installed Apache and PHP, you do it with


sudo apt-get install php5 php5-dev php5-gd php-pear

If you allready have Apache and PHP installed, then install just php-pear (unless it also is already installed). Now you can download, compile and install db2-module for PHP. You must have working internet connection to do this. Execute command


sudo pecl install ibm_db2

Script asks path to existing DB2 installation. The path you should give is


/home/db2inst1/sqllib

If compilation and installation was successful there is one last step. You have to modify the file /etc/php5/apache2/php.ini and add there following lines in the Extensions section


extension=ibm_db2.so
ibm_db2.instance_name=db2inst1

Then restart Apache with


sudo /etc/init.d/apache2 restart

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 105 other followers

%d bloggers like this: