From b47b7e597b566e6f19ed430fa4faea3a36905fc0 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Wed, 15 Feb 2023 22:19:03 -0300 Subject: [PATCH] Update `README.md` --- README.md | 110 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index d78e5fd..362572a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Interface for PHP to DB2 for z/OS, DB2 for LUW, DB2 for i. ## Pre-requisites -The minimum PHP version supported by driver is PHP 7.3 and the latest version supported is PHP 8.1. +The minimum PHP version supported by driver is PHP 7.3 and the latest version supported is PHP 8.2. ## IBM i users @@ -34,36 +34,48 @@ PHP, gcc, make, tar should be installed in your system. You may not find gcc, make, tar in some of the docker containers (Example Amazon Linux2). In such cases use below command to install gcc etc. + ```shell yum install make gcc ``` ## How to install php ibm_db2 extension in Linux/Mac. -``` -if IBM_DB_HOME and LD_LIBRARY_PATH environment variable not set then set them with installed CLIDRIVER. -(say CLIDRIVER installed at "/home/user/clidriver") +If `IBM_DB_HOME` and `LD_LIBRARY_PATH` environment variable not set then set them with installed CLIDRIVER. +(say CLIDRIVER installed at `/home/user/clidriver`) + +```shell export IBM_DB_HOME=/home/user/clidriver -export LD_LIBRARY_PATH=/home/user/clidriver/lib -export PATH=/home/user/clidriver/bin:$PATH +export LD_LIBRARY_PATH="${IBM_DB_HOME}/lib" +export PATH="${IBM_DB_HOME}/bin":$PATH +``` + +In case of Docker (Example Amazon Linux2), execute `db2level` command in your command prompt. If any error comes then install +`pam` from package manager: -In case of Docker(Example Amazon Linux2): - execute 'db2level' command in your command prompt, If any error comes then install 'pam' from package manager. - yum install pam +```shell +yum install pam +``` -1) pecl install ibm_db2 +1. Install this extension: + + ```shell + pecl install ibm_db2 + ``` -2) Open the php.ini file in an editor of your choice. Edit the extension entry in the - php.ini file in the /php/lib directory to reference the PHP driver: - extension=ibm_db2.so +2. Open the `php.ini` file in an editor of your choice. Edit the extension entry in the + `php.ini` file in the `/php/lib` directory to reference the PHP driver: + + ```ini + extension=ibm_db2.so + ``` -3) Ensure that the PHP driver can access the libdb2.so CLI driver file by - setting the LD_LIBRARY_PATH variable for Linux and UNIX operating systems - other than the AIX® operating system. For AIX operating system, you must set LIBPATH variable. +3. Ensure that the PHP driver can access the `libdb2.so` CLI driver file by + setting the `LD_LIBRARY_PATH` variable for Linux and UNIX operating systems + other than the AIX® operating system. For AIX operating system, you must set `LIBPATH` variable. -4) Optional: If the PHP application that is connecting to an IBM database server is running ini - the HTTP server environment, add the LD_LIBRARY_PATH variable in the httpd.conf file. +4. Optional: If the PHP application that is connecting to an IBM database server is running ini + the HTTP server environment, add the `LD_LIBRARY_PATH` variable in the `httpd.conf` file. -``` ## Prebuilt binaries for Windows 1. Add the `CLIDRIVER\bin` path to the `PATH` environment variable like so (for a batch file): @@ -75,50 +87,55 @@ In case of Docker(Example Amazon Linux2): 3. Open the `php.ini` file in an editor of your choice. Edit the extension entry in the `php.ini` file in the `\php\lib` directory to reference the driver: - ```` + + ```ini extension=php_ibm_db2 - ```` + ``` ## How to run sample program -### connect.php:- +Create a `connect.php` script with the following content: -``` +```php +``` -To run the sample:- php connect.php +Run the sample program: + +```shell +php connect.php ``` + ## How to build from source code in Linux or Mac -``` -Use the commands included in the source code: -download Source code from https://pecl.php.net/package/ibm_db2 - a) Extract the source archive - b) Run the following commands from the extracted directory: - $ phpize --clean - $ phpize - $ ./configure --with-IBM_DB2=/home/user/clidriver - $ make - $ make install -``` + +1. Download Source code from https://pecl.php.net/package/ibm_db2 +2. Extract the source archive +3. Run the following commands from the extracted directory: + + ```shell + phpize --clean + phpize + ./configure --with-IBM_DB2=/home/user/clidriver + make + make install + ``` ## How to build from source code in Windows -``` -Below blog mentiones how to build php ibm_db2 from source in windows. -https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Install_PHP_ibm_db2_Driver?lang=en -``` +[This blog](https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Install_PHP_ibm_db2_Driver?lang=en) +mentions how to build php ibm_db2 from source in Windows. ## Test suite @@ -144,9 +161,10 @@ the amount of systems in the wild without a properly set QCCSID, but you should do this anyways. To check and set QCCSID, run `WRKSYSVAL` from a 5250. ## Contributing: -``` -See CONTRIBUTING.md -The developer sign-off should include the reference to the DCO in defect remarks(example below): +See [`CONTRIBUTING.md`](CONTRIBUTING.md). +The developer sign-off should include the reference to the DCO in defect remarks, like in this example: + +``` DCO 1.1 Signed-off-by: Random J Developer ```