Scanning…
Instructions designed for IBM i developer learning PHP starting from ground zero …
On IBM i …
On laptop DRDA or ODBC …
Download Zend Server …
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.
Need some tests to try (a few include with XMLSERVICE) …
5250 > ADDLIBLE XMLSERVICE > CRTCLPGM PGM(XMLSERVICE/CRTTEST) SRCFILE(XMLSERVICE/QCLSRC) > call crttest
Example calling a typical IBM i functions with a few parameters.
//The ToolkitService connection method/function uses either IBM_DB2(default)or ODBC extensions to connect //to IBM i server. In order to switch to ODBC connection assign an "odbc' value to the $extension varibale //and make sure that the ODBC extension is enabled in the PHP.INI file. $extension='ibm_db2'; try { $ToolkitServiceObj = ToolkitService::getInstance($db, $user, $pass, $extension); } catch (Exception $e) { echo $e->getMessage(), "\n"; exit(); }
If you would like additional information on ibm_db2/ODBC connections to XMLSERVICE try these links.
How you choose to run your toolkit will greatly affect the overall performance.
/* do not use with internalKey */ $ToolkitServiceObj->disconnect();
Tony “Ranger” Cairns - IBM i PHP / PASE