This displays all extensions of PHP dynamically. Check for ibm_db2 and pdo_ibm in the output.

Second way: For the Windows environment, you can also download the latest driver files (with extension dll) from the Internet:

￿Download latest IBM_DB2 from: http://pecl4win.php.net/ext.php/php_ibm_db2.dll

￿Download latest PDO_IBM from: http://pecl4win.php.net/ext.php/php_pdo_ibm.dll

Once you have finished downloading DB2 PHP drivers, copy them to the PHP extension directory and update the php.ini file as described above.

Third way: You also can install both PDO_IBM and IBM_DB2 during the installation of PHP.

When selecting the install path and setting up the Web server (if required) during the PHP installation process, the PHP setup tool will prompt you to choose items to install. Select IBM_DB2 and PDO_IBM under the extensions tree and proceed with the installation.

If you have already installed PHP, you can run the setup again and choose change installation option. You can follow the same instructions as given in previous paragraph.

Note: You can gain more knowledge about PHP drivers by issuing the following commands”

php --re pdo_ibm php --re ibm_db2

You can seek assistance for any problem related to use of either PDO_IBM or IBM_DB2 by sending your queries to opendev@us.ibm.com.

4.4.5 Sample application

We now create a simple PHP application for demonstrating the deployment. This sample application named itso_phpapp.php reads the connectivity information from the command line and uses it to connect to a database. The database can be either local or remote. If the connection fails, the application will return an error message. If the connection succeeds, the application shows the success message. The complete code is shown in A.2, “PHP” on page 262 and is available for download. For the download instructions, refer to Appendix B, “Additional material” on page 267.

174DB2 Deployment Guide

Page 188
Image 188
IBM manual Sample application, 174 DB2 Deployment Guide