I installed dll files from the link https://github.com/ibmdb/php_ibm_db2.git, added them to ext added an extension to the php.ini file (this is the php.ini, since it installed the sql driver there) and still does not recognize the function and phpinfo does not detect the driver php version is 8.1
Fatal error: Uncaught Error: Call to undefined function db2_connect() in C:\xampp\htdocs\table21.php:23 Stack trace: #0 {main} thrown in C:\xampp\htdocs\table21.php on line 23
CodePudding user response:
To use PHP with IBM Db2, it requires both the php ibm_db2 extension for php, and a database-driver with an odbc interface. The database driver is not supplied with php ibm_db2, you must install it separately.
You can get the driver from IBM , or you can use a third party driver. If you want to use a driver from IBM, you can choose between different drivers (different footprints, different functionality etc). The largest footprint driver is the full IBM data server client
. The smallest driver from IBM is called CLIDRIVER and you can download it, unpack and run its db2cli install -setup
command on Microsoft Windows. To get the clidriver, follow the link "DOWNLOAD CLI DRIVER" at this link and read the instructions carefully at this documentation page.
You also need to be aware of licensing, when your target Db2 database lives either on i-series (as400), or mainframe (Db2 for Z/OS). In both these cases you may need a licence file on the hostname where php ibm_db2 runs. You do not need a licence file if your Db2 server is running on Microsoft Windows, Linux x64, AIX , cloud etc.