ibm_db2 & ODBC Run Side-by-Side in Seiden CP+ PHP
In the past, PHP on IBM i implementations demanded loyalty to a single database connection style: either the classic extensions (ibm_db2 / PDO_IBM) or the ODBC extensions (odbc / PDO_ODBC). Operating system limitations prevented both types from being loaded at the same time.
In July 2021, we overcame those limitations in Seiden CommunityPlus+ PHP. Yes, now the classic PHP database extensions can run side-by-side with ODBC!
As of this writing, you’ll find this feature exclusively in CP+ PHP. When you install Seiden CP+, all db2 extensions (ibm_db2, PDO_IBM, odbc, and PDO_ODBC) are enabled by default.
Why is this important?
Many IBM i teams want to upgrade their PHP programs from the classic extensions to PDO_ODBC, the new standard. Previously, they would have to set up additional servers to migrate programs to ODBC piecemeal.
Now they can adopt ODBC without affecting existing applications. They can migrate at their own pace by using both connectivity types in the same application. For example, a single PHP script can use ibm_db2 for one query and PDO_ODBC for another.
How do I use this feature if I have an older CP+ package?
First, update to our current software, especially the latest php-ibm_db2
, php-pdo_ibm
, and siteadd
packages. You can update them through ACS or through the command line like so:
1 |
$ yum update php-ibm_db2 php-pdo_ibm siteadd |
After updating, you can enable all the Db2 extensions using the toggle-db
command with the -t both flag. To do so for a specific site, point it to the site’s PHP extension INI directory:
1 |
$ toggle-db -t both -d /www/SITE_NAME_HERE/phpconf/conf.d |
To enable these extensions globally for PHP-CLI and all sites using a global (not custom) configuration:
1 |
$ toggle-db -t both |
If you have any questions, don’t hesitate to ask us.
Leave a Reply
Want to join the discussion?Feel free to contribute!