July 2021 Update
As of its 2021-07-23 update, Seiden PHP lets you run traditional Db2 extensions and ODBC in parallel. Just make sure you have the latest versions of all PHP packages.
With Seiden PHP, you have a choice of IBM i Db2 database extensions: odbc, PDO_ODBC, ibm_db2, and PDO_IBM.
For new sites
You don’t have to do anything other than making sure the php-ibm_db2
and php-pdo_ibm
packages are installed from Yum. Your site will be able to use them automatically.
Make sure you’re running the latest version of the drivers. Older versions of the drivers will have compatibility issues if running at the same time.
Converting sites from before coexisting extensions, automatically
Before the recent update, sites had to make a decision to use ODBC or classic database extensions. Now, you can convert your site to be able to use both. If you have an existing site to switch, or want to do for the global PHP settings, you can use the toggle-db utility included as part of siteadd. First, install it:
yum install siteadd
Then run it with “-t both” to enable both database extensions; for example, to convert the global PHP settings:
toggle-db -t both
Or to convert a specific site with site-specific configuration:
toggle-db -t both -d /www/mysite/phpconf/conf.d
Note that the tool also takes “odbc” (for ODBC and PDO_ODBC) or “classic” (for ibm_db2 and PDO_IBM). This is a remnant of when these extensions were mutually exclusive; you shouldn’t have to specify this.
Converting sites from before coexisting extensions, manually
If you can’t use the previous method, follow this instead. We use industry-standard .ini files to control our PHP extensions. By default, these .ini files will be in /QOpenSys/etc/php/conf.d
. To enable ibm_db2 and PDO_IBM, edit these .ini files to remove the semicolon from (to uncomment) the Db2 extensions and the odbc extensions, like so:
20-odbc.ini
: Remove semicolon from the extension directive:extension=odbc
30-pdo_odbc.ini
: Remove semicolon from the extension directive:extension=pdo_odbc
99-ibm_db2.ini
: Remove semicolon from the extension directive:extension=ibm_db2
99-pdo_ibm.ini
: Remove semicolon from the extension directive:extension=pdo_ibm
Restart the web server. PHP+ package updates will leave the configuration files alone when they’re changed, so you won’t need to change these files again after updates.
(If you need to disable an extension, simply add a semicolon to the beginning of the extension line in the .ini file to comment it out. Note that this is unnecessary now as ODBC and classic database extensions can be loaded at the same time.)