Connect PHP to IBM i (AS/400)

Rather than setup a 2nd box, why don't you look into the PHP Connector for iSeries? My mainframe guys said it was very easy to setup on our iSeries here.

We wrote a simple server in PHP that loads data models from DB2 data, serializes them, and returns them to the caller. This approach means that only another PHP app can consume the service but it's just so much quicker on both ends to just serialize the object and send it down the pipe.

Here is a PDF from IBM on the subject: http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf


To second @John Downey, I've gotten connectivity to work with PHP on an AS/400 with unixODBC.

Check your phpinfo() to see if unixODBC is available in it. I didn't have to compile it in on SLES 10.


Have you looked at connecting to the server using unixODBC? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out http://www.php.net/odbc for more information regarding the PHP side.

If you can't get that to work, the option to setup a web service on a Linux server may be all you can do.