Use ODBC instead of "ibm_db2" db2_connect().
On Debian-based Linux:
apt-get install -y php5-odbc unixodbc
Download the System i Access for Linux. More info here:
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzatv/rzatvinstall.htm
Install IBM i Access for Linux. More info at
http://yips.idevcloud.com/wiki/index.php/Tier2/IAccess
dpkg -i /opt/ibm/ibm-iaccess-1.1.0.3-1.0.amd64.deb
Then write PHP!
$conn = odbc_connect("DRIVER={IBM i Access ODBC Driver};DATABASE=$database;SYSTEM=$hostname;PROTOCOL=TCPIP", $user, $password);
More good reads:
http://www-03.ibm.com/systems/power/software/i/access/solutions.html
http://www.redbooks.ibm.com/abstracts/sg246551.html?Open
http://feub.net/2010/11/ingredients-php-db2-and-unixodbc/
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html#4.9
Austin Maddox
Lead Web Developer | I.T. Dept | Western Power Sports, Inc.
Email: amaddox@xxxxxxxxxxx | Web: www.wps-inc.com
-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Mark Murphy/STAR BASE Consulting Inc.
Sent: Monday, September 28, 2015 10:57 AM
To: Web Enabling the IBM i (AS/400 and iSeries)
Cc: web400@xxxxxxxxxxxx
Subject: Re: [WEB400] PHP Call to undefined function db2_connect() error
Unless your PHP server is on I, or you have the DB2 Connect product installed on your Server, You can't use db2_connect to attach to DB2 on IBM I. I have used ODBC successfully from a Windows server though.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----IBMiSoftwareEngineer <ibmisoftwareengineer@xxxxxxxxx> wrote: -----
To: web400@xxxxxxxxxxxx
From: IBMiSoftwareEngineer <ibmisoftwareengineer@xxxxxxxxx>
Date: 09/28/2015 09:52AM
Subject: [WEB400] PHP Call to undefined function db2_connect() error
We are trying to execute a PHP script on a Linux x86 server that accesses the DB2 database on an IBM i and are receiving the following error. We would appreciate any specific guidance.
PHP Fatal error: Call to undefined function db2_connect() in /var/www/product/product_dropdown.php
Googling seems to point to installing PECL on the Linux server. The docs usually reference IBM DB2 Universal Database and do not mention the IBM i
DB2 database so we are are unsure if this is the remedy.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.