Skip to content

Commit f91f731

Browse files
authored
Merge pull request #30 from phansys/readme
Update `README.md`
2 parents 75b16f6 + b47b7e5 commit f91f731

File tree

1 file changed

+64
-46
lines changed

1 file changed

+64
-46
lines changed

README.md

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Interface for PHP to DB2 for z/OS, DB2 for LUW, DB2 for i.
44

55
## Pre-requisites
66

7-
The minimum PHP version supported by driver is PHP 7.3 and the latest version supported is PHP 8.1.
7+
The minimum PHP version supported by driver is PHP 7.3 and the latest version supported is PHP 8.2.
88

99
## IBM i users
1010

@@ -34,36 +34,48 @@ PHP, gcc, make, tar should be installed in your system.
3434

3535
You may not find gcc, make, tar in some of the docker containers (Example Amazon Linux2).
3636
In such cases use below command to install gcc etc.
37+
3738
```shell
3839
yum install make gcc
3940
```
4041
## How to install php ibm_db2 extension in Linux/Mac.
41-
```
42-
if IBM_DB_HOME and LD_LIBRARY_PATH environment variable not set then set them with installed CLIDRIVER.
43-
(say CLIDRIVER installed at "/home/user/clidriver")
4442

43+
If `IBM_DB_HOME` and `LD_LIBRARY_PATH` environment variable not set then set them with installed CLIDRIVER.
44+
(say CLIDRIVER installed at `/home/user/clidriver`)
45+
46+
```shell
4547
export IBM_DB_HOME=/home/user/clidriver
46-
export LD_LIBRARY_PATH=/home/user/clidriver/lib
47-
export PATH=/home/user/clidriver/bin:$PATH
48+
export LD_LIBRARY_PATH="${IBM_DB_HOME}/lib"
49+
export PATH="${IBM_DB_HOME}/bin":$PATH
50+
```
51+
52+
In case of Docker (Example Amazon Linux2), execute `db2level` command in your command prompt. If any error comes then install
53+
`pam` from package manager:
4854

49-
In case of Docker(Example Amazon Linux2):
50-
execute 'db2level' command in your command prompt, If any error comes then install 'pam' from package manager.
51-
yum install pam
55+
```shell
56+
yum install pam
57+
```
5258

53-
1) pecl install ibm_db2
59+
1. Install this extension:
60+
61+
```shell
62+
pecl install ibm_db2
63+
```
5464
55-
2) Open the php.ini file in an editor of your choice. Edit the extension entry in the
56-
php.ini file in the <local_php_directory>/php/lib directory to reference the PHP driver:
57-
extension=ibm_db2.so
65+
2. Open the `php.ini` file in an editor of your choice. Edit the extension entry in the
66+
`php.ini` file in the `<local_php_directory>/php/lib` directory to reference the PHP driver:
67+
68+
```ini
69+
extension=ibm_db2.so
70+
```
5871
59-
3) Ensure that the PHP driver can access the libdb2.so CLI driver file by
60-
setting the LD_LIBRARY_PATH variable for Linux and UNIX operating systems
61-
other than the AIX® operating system. For AIX operating system, you must set LIBPATH variable.
72+
3. Ensure that the PHP driver can access the `libdb2.so` CLI driver file by
73+
setting the `LD_LIBRARY_PATH` variable for Linux and UNIX operating systems
74+
other than the AIX® operating system. For AIX operating system, you must set `LIBPATH` variable.
6275

63-
4) Optional: If the PHP application that is connecting to an IBM database server is running ini
64-
the HTTP server environment, add the LD_LIBRARY_PATH variable in the httpd.conf file.
76+
4. Optional: If the PHP application that is connecting to an IBM database server is running ini
77+
the HTTP server environment, add the `LD_LIBRARY_PATH` variable in the `httpd.conf` file.
6578

66-
```
6779
## Prebuilt binaries for Windows
6880

6981
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):
7587
7688
3. Open the `php.ini` file in an editor of your choice. Edit the extension entry in the
7789
`php.ini` file in the `<local_php_directory>\php\lib` directory to reference the driver:
78-
````
90+
91+
```ini
7992
extension=php_ibm_db2
80-
````
93+
```
8194
8295
## How to run sample program
8396
84-
### connect.php:-
97+
Create a `connect.php` script with the following content:
8598
86-
```
99+
```php
87100
<?php
101+
88102
$database = 'dsn name';
89103
$user = 'user';
90104
$password = 'password';
91105
$conn = db2_connect($database, $user, $password);
92106
93107
if ($conn) {
94-
echo "Connection succeeded.";
108+
echo 'Connection succeeded.';
95109
db2_close($conn);
96-
}
97-
else {
98-
echo "Connection failed: " . db2_conn_errormsg();
110+
} else {
111+
echo 'Connection failed: ' . db2_conn_errormsg();
99112
}
100113
?>
114+
```
101115

102-
To run the sample:- php connect.php
116+
Run the sample program:
117+
118+
```shell
119+
php connect.php
103120
```
121+
104122
## How to build from source code in Linux or Mac
105-
```
106-
Use the commands included in the source code:
107-
download Source code from https://pecl.php.net/package/ibm_db2
108-
a) Extract the source archive
109-
b) Run the following commands from the extracted directory:
110-
$ phpize --clean
111-
$ phpize
112-
$ ./configure --with-IBM_DB2=/home/user/clidriver
113-
$ make
114-
$ make install
115-
```
123+
124+
1. Download Source code from https://pecl.php.net/package/ibm_db2
125+
2. Extract the source archive
126+
3. Run the following commands from the extracted directory:
127+
128+
```shell
129+
phpize --clean
130+
phpize
131+
./configure --with-IBM_DB2=/home/user/clidriver
132+
make
133+
make install
134+
```
116135
## How to build from source code in Windows
117-
```
118-
Below blog mentiones how to build php ibm_db2 from source in windows.
119-
https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Install_PHP_ibm_db2_Driver?lang=en
120136

121-
```
137+
[This blog](https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Install_PHP_ibm_db2_Driver?lang=en)
138+
mentions how to build php ibm_db2 from source in Windows.
122139

123140
## Test suite
124141

@@ -144,9 +161,10 @@ the amount of systems in the wild without a properly set QCCSID, but you
144161
should do this anyways. To check and set QCCSID, run `WRKSYSVAL` from a 5250.
145162
146163
## Contributing:
147-
```
148-
See CONTRIBUTING.md
149164
150-
The developer sign-off should include the reference to the DCO in defect remarks(example below):
165+
See [`CONTRIBUTING.md`](CONTRIBUTING.md).
166+
The developer sign-off should include the reference to the DCO in defect remarks, like in this example:
167+
168+
```
151169
DCO 1.1 Signed-off-by: Random J Developer <random@developer.org>
152170
```

0 commit comments

Comments
 (0)