{"id":15021920,"url":"https://github.com/php/pecl-database-ibm_db2","last_synced_at":"2026-03-01T16:04:51.353Z","repository":{"id":20175888,"uuid":"23446775","full_name":"php/pecl-database-ibm_db2","owner":"php","description":"Extension for IBM DB2 Universal Database, IBM Cloudscape, and Apache Derby","archived":false,"fork":false,"pushed_at":"2025-10-30T19:27:10.000Z","size":1294,"stargazers_count":25,"open_issues_count":14,"forks_count":27,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-30T21:27:20.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pecl.php.net/package/ibm_db2","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-08-28T23:55:55.000Z","updated_at":"2025-10-30T19:27:14.000Z","dependencies_parsed_at":"2023-01-11T20:44:57.248Z","dependency_job_id":"a8e05217-1477-4e3b-b926-bcf8d56b5c35","html_url":"https://github.com/php/pecl-database-ibm_db2","commit_stats":{"total_commits":411,"total_committers":23,"mean_commits":"17.869565217391305","dds":0.6593673965936739,"last_synced_commit":"66c9ee181a564dae60b445b5f7a88e40c0a8adaf"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/php/pecl-database-ibm_db2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-ibm_db2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-ibm_db2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-ibm_db2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-ibm_db2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php","download_url":"https://codeload.github.com/php/pecl-database-ibm_db2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-ibm_db2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:57:13.361Z","updated_at":"2026-03-01T16:04:51.339Z","avatar_url":"https://github.com/php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IBM_DB2\n\nInterface for PHP to DB2 for z/OS, DB2 for LUW. [Db2 for IBM i support is deprecated](#new-implementations).\n\n## Pre-requisites\n\nThe minimum PHP version supported by driver is PHP 7.3 and the latest version supported is PHP 8.2.\n\n## LUW/z/Db2 Connect users\n\n[CLI driver](https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information) MUST be installed\nin your system. You can find and download the latest versions from [here](https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/).\n\n`php`, `gcc`, `make` and `tar` should be installed in your system.\n\nYou may not find `gcc`, `make`, `tar` in some of the docker images (like Amazon Linux2).\nIn such cases use below command to install `gcc`, etc.\n\n```shell\nyum install make gcc\n```\n\n## Db2 for IBM i\n\n### New implementations\n\n**NOTICE**: IBM [recommends](https://www.ibm.com/support/pages/node/883624) that if you are working on a new [Db2 for IBM i](https://www.ibm.com/support/pages/db2-ibm-i)\nconnection, you MUST use the [PDO_ODBC](https://www.php.net/manual/en/ref.pdo-odbc.php) or the [ODBC](https://www.php.net/manual/en/book.uodbc.php)\nextensions instead with the [ODBC Driver for IBM i Access Client Solutions](https://www.ibm.com/support/pages/odbc-driver-ibm-i-access-client-solutions).\n\n### Existing implementations\n\nIf you are using this extension with an existing connection running on IBM i, `IBM_DB2` doesn't link with the Db2 LUW client\nlibrary, but instead with libdb400, which provides a PASE wrapper for SQL/CLI. The differences between SQL/CLI in IBM i and\nthe LUW driver are wrapped for you. You don't need Db2 Connect on IBM i as a result.\n\nTo install, make sure you have the new Yum-based OSS environment. Install PHP,\nplus any dependencies like so:\n\n```shell\nyum install sqlcli-devel gcc make-gnu\n```\n\nTony Cairns' [replacement libdb400](https://bitbucket.org/litmis/db2sock/src/master/db2/)\nis not yet tested, but may be desirable due to its greater debugging features.\n\n## How to install php ibm_db2 extension in Linux/Mac.\n\nIf `IBM_DB_HOME` and `LD_LIBRARY_PATH` environment variable not set then set them with installed CLIDRIVER.\n(say CLIDRIVER installed at `/home/user/clidriver`)\n\n```shell\nexport IBM_DB_HOME=/home/user/clidriver \nexport LD_LIBRARY_PATH=\"${IBM_DB_HOME}/lib\"\nexport PATH=\"${IBM_DB_HOME}/bin\":$PATH\n```\n\nIn case of Docker (Example Amazon Linux2), execute `db2level` command in your command prompt. If any error comes then install\n`pam` from package manager:\n\n```shell\nyum install pam\n```\n\n1. Install this extension:\n\n   ```shell\n   pecl install ibm_db2\n   ```\n        \n2. Open the `php.ini` file in an editor of your choice. Edit the Dynamic Extensions entry in the\n   `php.ini` file in the `\u003clocal_php_directory\u003e/php/lib` directory to reference the PHP driver:\n\n   ```ini\n   extension=ibm_db2.so\n   ```\n       \n3. Ensure that the PHP driver can access the `libdb2.so` CLI driver file by\n   setting the `LD_LIBRARY_PATH` variable for Linux and UNIX operating systems\n   other than the AIX® operating system. For AIX operating system, you must set `LIBPATH` variable. \n\n4. Optional: If the PHP application that is connecting to an IBM database server is running ini\n   the HTTP server environment, add the `LD_LIBRARY_PATH` variable in the `httpd.conf` file.\n\n## Prebuilt binaries for Windows\n\n1. Add the `CLIDRIVER\\bin` path to the `PATH` environment variable like so (for a batch file):\n    ```\n    set PATH=\u003cCLIDRIVER installed path\u003e\\bin;%PATH%\n    ```\n2. Download the DLLs for PHP 7.x and 8.x from [the ibmdb repository](https://github.com/ibmdb/php_ibm_db2).\n   Select the build for the PHP that matches the version, architecture, and thread model.\n\n3. Open the `php.ini` file in an editor of your choice. Edit the Dynamic Extensions entry in the\n   `php.ini` file in the `\u003clocal_php_directory\u003e\\php\\lib` directory to reference the driver:\n\n    ```ini\n    extension=php_ibm_db2\n    ```\n\n## How to run sample program\n\nCreate a `connect.php` script with the following content:\n\n```php\n\u003c?php\n\n$database = 'dsn name';\n$user = 'user';\n$password = 'password';\n$conn = db2_connect($database, $user, $password);\n\nif ($conn) {\n    echo 'Connection succeeded.';\n    db2_close($conn);\n} else {\n    echo 'Connection failed: ' . db2_conn_errormsg();\n}\n?\u003e\n```\n\nRun the sample program:\n\n```shell\nphp connect.php\n```\n\n## How to build from source code in Linux or Mac\n\n1. Download Source code from https://pecl.php.net/package/ibm_db2\n2. Extract the source archive\n3. Run the following commands from the extracted directory:\n\n    ```shell\n    phpize --clean\n    phpize\n    ./configure --with-IBM_DB2=/home/user/clidriver\n    make\n    make install\n    ```\n## How to build from source code in Windows\n\n[This blog](https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Install_PHP_ibm_db2_Driver?lang=en)\nmentions how to build php ibm_db2 from source in Windows.\n\n## Test suite\n\n`make test` is adequate for most tests except those involving XMLSERVICE.\nFor more complex tests, use `run-tests.php` and set `TEST_PHP_ARGS` as needed.\n\nMany tests rely on having libraries like `DB2` added. On IBM i, `create schema`\ninstead of `crtlib` is recommended to properly set up things like journals.\nPlease let us know if there are any hardcoded library names; we've tried to\nclean up usage of them when not documented.\n\nIf you have strange failures during the tests, you might want to adjust the\nautocommit setting. `ibm_db2.i5_allow_commit=1` is tested to work.\n\nOn IBM i, you might want to use `*LOCAL` as your DSN without a username or\npassword. This means you won't need to provide another account for most tests.\nModify `tests/connection.inc` to do so.\n\nOn IBM i, it's strongly recommended to set QCCSID to a reasonable value, not\n65535. Without setting this, you will have many string values failing to\nconvert from EBCDIC. `IBM_DB2` provides a workaround for this nowadays due to\nthe amount of systems in the wild without a properly set QCCSID, but you\nshould do this anyways. To check and set QCCSID, run `WRKSYSVAL` from a 5250.\n\n## Contributing:\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md).\nThe developer sign-off should include the reference to the DCO in defect remarks, like in this example:\n\n```\nDCO 1.1 Signed-off-by: Random J Developer \u003crandom@developer.org\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-database-ibm_db2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp%2Fpecl-database-ibm_db2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-database-ibm_db2/lists"}