-
install php_oci8_11g
-
php -i view phpinfo, php7.4-ts-x64.
PHP Version => 7.4.0
Architecture => x64
PHP Extension Build => API20190902,TS,VC15 -
download php_oci8_11g
go to PECL :: Package :: oci8 2.2.0 for Windows download 7.4 Thread Safe (TS) x64 .
-
config php.ini
add
extension=php_oci8_11g.dll
in php.ini
-
-
install oracle instant_client
download oracle instant_client 11g 64bit, instant_client version must match php architecture, such as php-x64 instant_client must is x64.
-
test connection
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$conn = oci_connect('xxx', 'xxx', 'www.jbn.com:1523/DEV');
if (!$conn) {
$e = oci_error();
echo $e['message'];
}
$stid = oci_parse($conn, 'SELECT empno, ename, job FROM scott.emp');
oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
echo $item . " ";
}
echo "\n";
}