apt-get install unixodbc unixodbc-dev dpkg -i ibm-iaccess-1.1.0.11-1.0.amd64.deb apt-get install php7.0-odbc odbcinst -i -d -f /opt/ibm/iaccess/unixodbcregistration nano /etc/odbc.ini
On the ini file type:
[MyDSN] Description = Company DB Driver = IBM i Access ODBC Driver System = myserver.mycompany.local UserID = username Password = password Naming = 0 DefaultLibraries = mylibrary Database = ConnectionType = 1 (0=read/write; 1=readonly) BlockFetch = 1 BlockSizeKB = 512 [MyDSN2] Description = Company DB2 Driver = IBM i Access ODBC Driver System = myserver2.mycompany.local UserID = username Password = password Naming = 0 DefaultLibraries = mylibrary Database = ConnectionType = 1 BlockFetch = 1 BlockSizeKB = 512 .....
On my php file with PDO:
$pdo = new PDO("odbc:MyDSN");
$stmt = $pdo->query("SELECT * FROM mytable");
while ($row = $stmt->fetch()) {
print_r($row);
}