(click to open)

Quick Page Table of Contents


DB2 Connect access only …

Goto Main Page
Goto Documents

Who is this page for?

Instructions designed for IBM i developer learning PHP starting from ground zero …

  • … installing PHP on a laptop
  • … little control over IBM i machine (can’t install Zend Server on IBM i)
  • … but have a DB2 Connect DRDA connection to IBM i (good enough)


On IBM i …

  • recent IBM i DB2 PTFs or XMLSERVICE clobs will fail (PHP ibm_db2 drivers)
    • XMLSERVICE 1.7.5 (see toolkit.ini setting for QXMLSERV below):
           - PTF '5770DG1 V7R1M0 SI48830'
           - PTF '5761DG1 V6R1M0 SI48831'
           - PTF '5722DG1 V5R4M0 SI48440'
           - change toolkit.ini: XMLServiceLib = "QXMLSERV"

On laptop …

1) Install PHP on your PC/laptop

Download Zend Server …

  • {Zend Download site} - Zend Server Community Edition
    • … click download for your laptop (Linux, Mac, Windows)
  • Install Zend Server on your laptop
    • php-x.x-extra-extensions-zend-server — Linux install extra to run odbc

Download PHP toolkit and CW …
{Goto Main Page} and {Download Latest} version of cw-php-x.x.x.zip PHP framework. This zip file contains all the PHP code required to use the new toolkit from your laptop (your DB2 Connect).

Follow the instructions below to install the php code (Linux, but Windows similar) …

cd /usr/local/zend/share
sudo unzip cw-php-1.1.2.zip
sudo mkdir ToolkitApi
sudo mv ToolkitApi.zip ToolkitApi/.
sudo unzip ToolkitApi.zip
sudo gedit php.ini &
; UNIX: "/path1:/path2"
include_path = ".:/usr/local/zend/share/ToolkitApi:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear"
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

Note: If you are using the IBM i PTFS for XMLSERVICE change toolkit.ini: XMLServiceLib = “QXMLSERV”. Also check the lugconnect PHP script and change XMLSERVICE library to QXMLSERV as needed.

Run ibm_db2 to IBM i

Need some tests to try (a few include with XMLSERVICE) …

> call crttest

Let’s try a test …

In this case we will NOT be using the PHP toolkit from Zend, but use just XML across the PHP ibm_db2 connection. After you have used XMLSERVICE for awhile you will realize that there are many ways to contact IBM i and get work done (including no script at all like the LUG/ZendCon demo).

On your laptop create these files for testing via Zend Studio (or Apache, or command line)..

Run new PHP Toolkit to IBM i

Step 1) Follow install PHP toolkit instructions above

Step 2) Let’s try a test using PHP Toolkit …

In this case we WILL be using the PHP toolkit from Zend from your laptop … nice thing to remember is all works the same when you move it up to your production IBM i and/or you switch drivers from ibm_db2 to odbc (f-l-e-x-i-b-l-e).

  • Common files (click to view)
  • A test (click to view)
    • lugtoolkitibmdb2.php - using new PHP Toolkit over ibm_db2 connection (yep, same connection as last example)