(click to open)

Quick Page Table of Contents


ODBC client 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 Client Access ODBC connection to IBM i (good enough)


  • 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 …

  • iAccess ODBC connection to IBM i (Client Access ODBC)
    • {PHP odbc … using iAccess ODBC from Linux/Windows/Mac}
      • Linux true 64 bit ODBC manager may have trouble running iAccess 64 for Linux. For most 64-bit platforms, you can also install the 32-bit version. Whichever one you install, the last one installed will become the default ODBC driver. See the unixODBC configuration file, odbcinst.ini, for more information. iAccess 64 issue

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 CA ODBC).

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 odbc 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 odbc 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)..

  • download (click to download)
  • Common files (click to view)
  • A test (click to view)
    • faster option 1: PHP odbc driver does not allow XMLSERVICE in/out procedure call (try ibm_db2)
    • slower option 2: lugzzcallodbc.php - using XMLSERVICE result set procedure iPLUGRxxx(?,?,?)
  • Kill *immed my XMLSERVICE job (click to view)

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 odbc to ibm_db2 (f-l-e-x-i-b-l-e).

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