<p>I've got an upcoming project wherein I will need to connect our website (<code>PHP5/Apache 1.3/OpenBSD 4.1</code>) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.</p>

<p>From what I've seen the DB2 extensions and DB2 software from IBM only run under Linux. I've tried compiling the extensions with all the software from IBM and even tried their precompiled ibm_db2 extension with no luck. IBM only supports Linux so I turned on the Linux emulation in the kernel but that didn't seem to help anything.</p>

<p>If anyone has run across getting everything to run natively under OpenBSD that would be great, but what I think I may have to do is setting up a second server running CentOS with DB2 installed (most likely via ZendCore for IBM since it seems to do all this for me) and the driver so that I can set up a small transaction server that I can post against and get a JSON representation of the DB2 data that I need.</p>

<p>Does the second option seem overkill or does anyone else have any better ideas?</p>

[{'answer_id': 704, 'author': 'John Downey', 'author_id': 200, 'author_profile': 'https://Stackoverflow.com/users/200', 'pm_score': 5, 'selected': True, 'text': '<p>Have you looked at connecting to the server using <a href="http://www.unixodbc.org/" rel="noreferrer">unixODBC</a>? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out <a href="http://www.php.net/odbc" rel="noreferrer">http://www.php.net/odbc</a> for more information regarding the PHP side.</p>\n\n<p>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.</p>\n'}, {'answer_id': 836, 'author': 'dragonmantank', 'author_id': 204, 'author_profile': 'https://Stackoverflow.com/users/204', 'pm_score': 2, 'selected': False, 'text': "<p>Looks like a web service is going to be the answer for me. On a production box I'd rather not have to go through compiling and maintaining my own special installation of PHP since ODBC support needs to be compiled in, according to the PHP documentation.</p>\n"}, {'answer_id': 17038, 'author': 'J.T. Grimes', 'author_id': 1676, 'author_profile': 'https://Stackoverflow.com/users/1676', 'pm_score': 1, 'selected': False, 'text': "<p>A web service is almost certainly the way to go.  I'm sure you've already thought of this, but since you're doing PHP on both sides, you can shortcut things a little bit by using serialize() to build your response data instead of building a proper XML document.  It's less flexible over the long run, but it will probably get you up and running more quickly.</p>\n"}, {'answer_id': 25436, 'author': 'andyhky', 'author_id': 2764, 'author_profile': 'https://Stackoverflow.com/users/2764', 'pm_score': 2, 'selected': False, 'text': "<p>To second @John Downey, I've gotten connectivity to work with PHP on an AS/400 with unixODBC.</p>\n\n<p>Check your phpinfo() to see if unixODBC is available in it. I didn't have to compile it in on SLES 10. </p>\n"}, {'answer_id': 25617, 'author': 'jsight', 'author_id': 1432, 'author_profile': 'https://Stackoverflow.com/users/1432', 'pm_score': 1, 'selected': False, 'text': '<p>Indeed, a webservice seems like a great way to solve the problem.  One way to avoid having a completely separate OS for it would be to write the webservice in Java on top of the AS400 tools for Java (which are quite nice, btw).  That should at least let you run your service layer on the OpenBSD box as well.</p>\n'}, {'answer_id': 31091, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>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. </p>\n\n<p>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.</p>\n\n<p>Here is a PDF from IBM on the subject: <a href="http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf" rel="nofollow noreferrer">http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf</a></p>\n'}, {'answer_id': 121074, 'author': 'Mike Wills', 'author_id': 2535, 'author_profile': 'https://Stackoverflow.com/users/2535', 'pm_score': 1, 'selected': False, 'text': '<p>You can connect directly using a standard ODBC driver as well. The IBM version usually gives you more features like being able to call programs and things like that. If you only need SQL and stored procedures, ODBC should work.</p>\n'}, {'answer_id': 158959, 'author': 'Till', 'author_id': 2859, 'author_profile': 'https://Stackoverflow.com/users/2859', 'pm_score': 1, 'selected': False, 'text': '<p>Why not use PDO from PHP? I have to guess here since I could not find a public list of all ports available for OpenBSD, but since there is a port for FreeBSD, NetBSD etc. maybe you get lucky as well.</p>\n\n<p>(I guess that even though OpenBSD links to FreeBSD\'s porter\'s handbook, <a href="http://www.freshports.org/" rel="nofollow noreferrer">Freshports</a> is not applicable for your system?)</p>\n\n<p>If PDO is not available and since I am hoping you use ports and according to the following link there is php5-ODBC available:</p>\n\n<ul>\n<li><a href="http://www.openbsd.org/pkg-stable40.html" rel="nofollow noreferrer">http://www.openbsd.org/pkg-stable40.html</a></li>\n</ul>\n\n<p>So assuming you manage your system through ports, there are your pointers.</p>\n\n<p>Hope that helps!</p>\n'}]
['https://Stackoverflow.com/questions/696', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/204/']