1. Installing Informix Client SDK for Linux x86_64
1.1 Download Informix Client SDK 3.70 for Linux x86_64 from IBM website, https://www-01.ibm.com/marketing/iwm/tnd/search.jsp?rs=ifxdl
1.2 Extract the file, `cd /opt/informix; tar -xvf clientsdk.3.70.FC8DE.LINUX.tar`
1.3 Start installation, `./installclientsdk`, install all
2. Installing PDO Informix
2.1 Download PDO Informix 1.3.1, `wget https://pecl.php.net/get/PDO_INFORMIX-1.3.1.tgz`
2.2 Extract the file, `tar -xvf PDO_INFORMIX-1.3.1.tgz`
2.3 `cd PDO_INFORMIX-1.3.1` and compiling
2.3.1 `phpize`
2.3.2 `./configure –with-pdo-informix=/opt/informix`, if getting error `configure: error: Cannot find php_pdo_driver.h`, do `ln -s /usr/include/php5 /usr/include/php` and try again.
2.3.3 `make`
2.3.4 `make install`
3. Include pdo_informix.so in php.ini
Other reference: http://stackoverflow.com/questions/19909075/php-and-informix-on-debian-how-to-install-configure-the-pdo
Sample Code:
<?php
$db = new PDO("informix:host=hostname_or_ipaddr; service=port;database=dbname; server=instancename; protocol=onsoctcp;EnableScrollableCursors=1;", "username", "password");
print "Connection Established!\n\n";
$stmt = $db->query("select * from tablename");
$res = $stmt->fetch( PDO::FETCH_BOTH );
$rows = $res[0];
echo "Table contents: $rows.\n";
?>