PHP Toolkit for IBM iConnect your PHP applications to resources on your IBM i (evolved from AS/400, iSeries) using the open source (free!) PHP Toolkit for IBM i.

Co-developed by Alan Seiden and maintained by the IBM i community, the toolkit is also known as the XML Toolkit because the PHP front end and the XMLSERVICE RPG back end communicate via XML.

Start Here

Get a good start with the PHP Toolkit by reading Alan’s presentation Bring RPG/COBOL Business Logic to the Web with the PHP Toolkit (PDF format). Note: these slides date from about 2017 and don’t reflect RPM-based PHP paths and other changes.

Sample scripts, options, and other resources

Where to find the PHP Toolkit

 

22 replies
  1. Angel
    Angel says:

    To work with PHP what exactly do I need to download and install on System i and on Windows?

    What configuration manuals or examples can help me?

    Thanks for your help.

    Reply
    • Alan Seiden
      Alan Seiden says:

      Angel, if you run PHP on Windows, I’d suggest installing the PHP Toolkit using the “install via Composer” instructions above, or by copying the code down from Github. The toolkit is just PHP code. Nothing needs to be installed on the IBM i. Connect using the PDO_ODBC transport option, as shown in one of the sample scripts (linked above).

      Reply
  2. Erica
    Erica says:

    We are using the iToolkitService.php to call an RPG service program to retrieve data for a simple PHP display. Recently, we switched that RPG service program from an outside purchased http post procedure to the IBM http sql functions, in this case HTTPGETCLOBVERBOSE. The XMLSERVICE job is no longer returning the needed data, and there are various sql and java errors in the logs.
    JVAB309
    User-defined function error on member QSQPTABL. SQLSTATE 58004.
    SQL4301 Java interpreter startup or communication failed for reason code 1.

    Is there another parameter I should be using here?

    $obj = ToolkitService::getInstance($system, $user, $pwd);
    $obj->setToolkitServiceParams(array(‘InternalKey’=>”/tmp/$user”));

    Reply
  3. Isabelle Carmier
    Isabelle Carmier says:

    Hello Alan,
    I have a problem with a CLLE that I am calling with a pgmcall.
    In this program I run sql on PF (create, insert, delete….).
    It works fine on our as400 but when I call it via php nothing seems to have been executed.
    Would you have encountered this problem?
    Regards

    Reply
  4. Jason Lewis
    Jason Lewis says:

    If XMLSERVICE is installed and setup on the IBMi with an apache instance could the PHP Toolkit be used on another webserver such as windows?

    Would the only requirement be that the toolkit PHP need to be placed on the windows webserver?
    I see with Zendserver for windows they have the toolkit plugin, but we are looking for a cheaper (or free) solution for the hosting.

    We are looking to keep the web server hosting for the front facing pages off the IBMi but use the toolkit functions for the ease of use of IBMi resources like program calls ect.

    Reply
    • Alan Seiden
      Alan Seiden says:

      Hi, Jason, that’s correct. XMLSERVICE comes pre-installed in QXMLSERV these days. You’d only need to install the toolkit PHP with your front-end code (in your case, a Windows server). Choose a “transport” that can connect to the IBM i without needing a license. PDO_ODBC or odbc or HTTP would be good options. Let us know if you need any help. Alan

      Reply
  5. Brian Zeuske
    Brian Zeuske says:

    Hello Allan,
    I’ve been working on a project converting net.data to php. For the most part, I’ve been having pretty good success. But every now and then I run into a snag. One such snag is with tool kit. In net.data, you can call a CL program directly from a net.data document that can create a workfile in qtemp that you can later run sql over in the same net.data document. I’m not able to do that in tool kit because it runs in a different job. So instead, I’m loading a multidimensional array using a prototype program. It works if I call the prototype program directly. But if I call a CL program in-between for the purpose of running an opnqry statement, the process errors. It seems to be working until it gets to the IPLUGR512K procedure.

    Any thoughts?

    Thank you,

    Brian Zeuske

    Reply
    • Alan Seiden
      Alan Seiden says:

      Hi, Brian, if you use stateless mode then the CL program would run in the same job as SQL, if called within the same PHP request, thus QTEMP should be fine. I get the impression that there is more to your question. It seems a little complicated for a comment on this page. Maybe you should email me with more details. — Alan

      Reply
  6. Alessandro Scolavino
    Alessandro Scolavino says:

    I tried xml toolkit but it seems it doesn’t support large query, i tried to fetch 10000 records and it generate an error on AS400, is there some limitation that you are aware of?

    Reply
  7. Avrohom Notik
    Avrohom Notik says:

    If You have problems with passing parameters, just write to database file, and the target program will read it. Just as simple as that.

    Reply
  8. Praveen
    Praveen says:

    I am trying to connect ibm iseries using zend framework 2 through localhost. I have configured database details in global.php now need to call stored procedure using database object. I have gone through the questions answered by you on stackoverflow but I am unable to do anything and I have blocked.
    Can please help me in this,

    Reply
  9. Alan Seiden
    Alan Seiden says:

    Hi, Peter,

    I’m working on a toolkit update to support PCML with PgmCall. Do you use PCML heavily?

    PCML is currently supported only by the compatibility wrapper [CW], but because new projects should use the new toolkit API (PgmCall, etc.) instead of CW, I intend to add PCML support for PgmCall.

    Tell me more about your requirements if you would like, perhaps through my contact page.

    Best regards,
    Alan

    Reply
  10. Klaus-Peter Luttkus
    Klaus-Peter Luttkus says:

    Hello Alan, last year I attended one of your presentations on PHP on IBM i. Very interesting. I now have a problem with the API Toolkit, and so farI didn’t find any answers. Is there a way to declare parameters für the PgmCall method by way of using PCML? A short answer would be appreciated.

    Regards from Germany
    Peter

    Reply
  11. Barbara Fullenwider
    Barbara Fullenwider says:

    Could you recommend a site that explains and gives example of passing multi occurrence parameter to and RPG program and return parameters. We are stuck at work and do not know where to look

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

22 replies
  1. Angel
    Angel says:

    To work with PHP what exactly do I need to download and install on System i and on Windows?

    What configuration manuals or examples can help me?

    Thanks for your help.

    Reply
    • Alan Seiden
      Alan Seiden says:

      Angel, if you run PHP on Windows, I’d suggest installing the PHP Toolkit using the “install via Composer” instructions above, or by copying the code down from Github. The toolkit is just PHP code. Nothing needs to be installed on the IBM i. Connect using the PDO_ODBC transport option, as shown in one of the sample scripts (linked above).

      Reply
  2. Erica
    Erica says:

    We are using the iToolkitService.php to call an RPG service program to retrieve data for a simple PHP display. Recently, we switched that RPG service program from an outside purchased http post procedure to the IBM http sql functions, in this case HTTPGETCLOBVERBOSE. The XMLSERVICE job is no longer returning the needed data, and there are various sql and java errors in the logs.
    JVAB309
    User-defined function error on member QSQPTABL. SQLSTATE 58004.
    SQL4301 Java interpreter startup or communication failed for reason code 1.

    Is there another parameter I should be using here?

    $obj = ToolkitService::getInstance($system, $user, $pwd);
    $obj->setToolkitServiceParams(array(‘InternalKey’=>”/tmp/$user”));

    Reply
  3. Isabelle Carmier
    Isabelle Carmier says:

    Hello Alan,
    I have a problem with a CLLE that I am calling with a pgmcall.
    In this program I run sql on PF (create, insert, delete….).
    It works fine on our as400 but when I call it via php nothing seems to have been executed.
    Would you have encountered this problem?
    Regards

    Reply
  4. Jason Lewis
    Jason Lewis says:

    If XMLSERVICE is installed and setup on the IBMi with an apache instance could the PHP Toolkit be used on another webserver such as windows?

    Would the only requirement be that the toolkit PHP need to be placed on the windows webserver?
    I see with Zendserver for windows they have the toolkit plugin, but we are looking for a cheaper (or free) solution for the hosting.

    We are looking to keep the web server hosting for the front facing pages off the IBMi but use the toolkit functions for the ease of use of IBMi resources like program calls ect.

    Reply
    • Alan Seiden
      Alan Seiden says:

      Hi, Jason, that’s correct. XMLSERVICE comes pre-installed in QXMLSERV these days. You’d only need to install the toolkit PHP with your front-end code (in your case, a Windows server). Choose a “transport” that can connect to the IBM i without needing a license. PDO_ODBC or odbc or HTTP would be good options. Let us know if you need any help. Alan

      Reply
  5. Brian Zeuske
    Brian Zeuske says:

    Hello Allan,
    I’ve been working on a project converting net.data to php. For the most part, I’ve been having pretty good success. But every now and then I run into a snag. One such snag is with tool kit. In net.data, you can call a CL program directly from a net.data document that can create a workfile in qtemp that you can later run sql over in the same net.data document. I’m not able to do that in tool kit because it runs in a different job. So instead, I’m loading a multidimensional array using a prototype program. It works if I call the prototype program directly. But if I call a CL program in-between for the purpose of running an opnqry statement, the process errors. It seems to be working until it gets to the IPLUGR512K procedure.

    Any thoughts?

    Thank you,

    Brian Zeuske

    Reply
    • Alan Seiden
      Alan Seiden says:

      Hi, Brian, if you use stateless mode then the CL program would run in the same job as SQL, if called within the same PHP request, thus QTEMP should be fine. I get the impression that there is more to your question. It seems a little complicated for a comment on this page. Maybe you should email me with more details. — Alan

      Reply
  6. Alessandro Scolavino
    Alessandro Scolavino says:

    I tried xml toolkit but it seems it doesn’t support large query, i tried to fetch 10000 records and it generate an error on AS400, is there some limitation that you are aware of?

    Reply
  7. Avrohom Notik
    Avrohom Notik says:

    If You have problems with passing parameters, just write to database file, and the target program will read it. Just as simple as that.

    Reply
  8. Praveen
    Praveen says:

    I am trying to connect ibm iseries using zend framework 2 through localhost. I have configured database details in global.php now need to call stored procedure using database object. I have gone through the questions answered by you on stackoverflow but I am unable to do anything and I have blocked.
    Can please help me in this,

    Reply
  9. Alan Seiden
    Alan Seiden says:

    Hi, Peter,

    I’m working on a toolkit update to support PCML with PgmCall. Do you use PCML heavily?

    PCML is currently supported only by the compatibility wrapper [CW], but because new projects should use the new toolkit API (PgmCall, etc.) instead of CW, I intend to add PCML support for PgmCall.

    Tell me more about your requirements if you would like, perhaps through my contact page.

    Best regards,
    Alan

    Reply
  10. Klaus-Peter Luttkus
    Klaus-Peter Luttkus says:

    Hello Alan, last year I attended one of your presentations on PHP on IBM i. Very interesting. I now have a problem with the API Toolkit, and so farI didn’t find any answers. Is there a way to declare parameters für the PgmCall method by way of using PCML? A short answer would be appreciated.

    Regards from Germany
    Peter

    Reply
  11. Barbara Fullenwider
    Barbara Fullenwider says:

    Could you recommend a site that explains and gives example of passing multi occurrence parameter to and RPG program and return parameters. We are stuck at work and do not know where to look

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.