How to make OCI8 uses 9iR2client libraries on Linux? - php

I need to connect to an Oracle 8i server, but oci8 does not support it by default.
The php documentation says as following:
Note:
If OCI8 uses 9iR2 client libraries, then PHP can connect to Oracle Database 8i, 9iR2, 10g or 11g. If OCI8 uses 10gR2 client libraries, the database can be 9iR2, 10g, 11g or 12c. If OCI8 uses 11g client libraries, the database can be 9iR2, 10g, 11g or 12c. If OCI8 uses 12c client libraries, the database can be 10gR2, 11g or 12c.
How can I setup OCI8 to use 9iR2 client libraries?
My current environment is:
I'm on a ubuntu server,
Oracle 8i version 8.1.7.4.0
I have already installed instantclient libraries(I'm able to connect to oracle 10i and above)
I'm using instantclient version 12.1... Also tried with instantclient version 10.2
Could someone help me figuring out what the problem might be and how to solve it? Any help is really appreciated.
Thank you

Related

oci8, php7 and Oracle 10.1 compatibility

I have to upgrade a system from php5.6 to php7.2. The system uses an oracle 10.1 database.
Now I tried to collect all infos but am still confused about the compatibility between php, oci8, instant client and the database.
I read, that with php7 I have to at least install oci8 2.1, but this doesn't work with oracle 10.1.
Is that correct?
Or is it possible to run php7 with oracle 10.1?
Please enlighten me :)
I read, that with php7 I have to at least install oci8 2.1, but this doesn't work with oracle 10.1.
Is that correct?
No. From the manual:
OCI8 2.0 requires Oracle 12c, 11g or 10g client libraries and will install on PHP 5.2 onwards.
Note that the Oracle client version you use doesn't need to match the server version. From the same manual page (reformatted into bullet points for ease of reading):
If OCI8 uses 9iR2 client libraries, then PHP can connect to Oracle Database 8i, 9iR2, 10g or 11g.
If OCI8 uses 10gR2 client libraries, the database can be 9iR2, 10g, 11g or 12c.
If OCI8 uses 11g client libraries, the database can be 9iR2, 10g, 11g or 12c.
If OCI8 uses 12c client libraries, the database can be 10gR2, 11g or 12c.
So only the last scenario (12c client libraries) requires a database version greater than 10.1.
Regardless of what the manual says, I would strongly recommend building a test instance and seeing if you have any issues.
Edit:
Further information from the OCI8 package PECL page:
Oracle's standard cross-version connectivity applies. For example,
PHP OCI8 linked with Instant Client 11.2 can connect to Oracle
Database 9.2 onward. See Oracle's note "Oracle Client / Server
Interoperability Support" (ID 207303.1) for details.

Connect PHP to Oracle 12c on Oracle Linux 7.2

I have downloaded;
Oracle Linux 7.2
Oracle Database 12c for Linux
Oracle Instance Client for 12c
(All are of the same version)
What I was successful with;
Installing Oracle Linux on VMWare
Installing Oracle Database 12c
I need to;
Install LAMP with the capability of connecting to Oracle Database.
Install Instant Client with the capability of connecting php to Oracle Database.
Install phpmyadmin
Please Help ...
There are PHP RPMs (including one for the PHP OCI8 driver to connect to Oracle Database) at http://yum.oracle.com/oracle-linux-php.html
You will need to install the 'Basic' package from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html first (this requires a click-through so it can't be in a yum channel). It sounds like you have done this.
There's a lot of useful info about PHP OCI8 in the back half of this free book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

OCI8 configuration with WAMP64

I am trying to connect Oracle 11gXE with php. For php I downloaded wamp64 which is a 64bit version and the Oracle 11gXE is also 64bit. I am using windows 10 also 64bit.
Now I never connected Oracle to php so after searching a lot I found OCI and PDO_OCI among which OCI is recommended.
Now following steps were mentioned everywhere.
Download OCI thin client zip from oracle's official website.
Extract the zip
Include the path in environment variable.
Enable extension = php_oci8_12c.dll (or what ever oracle version you have) in php.ini
then use this $con = oci_connect($username, $password, $connection_string);
Now I have followed the steps, but failed to connect.
Following code to establish connection.
<?php
$username = "ABCD";
$password = "1234";
$connection_string = "localhost/XE";
$con = oci_connect($username, $password, $connection_string);
if(!$con) {
echo "Faild to connect";
}
else {
echo "Success";
}
?>
Now it show this error
So then I again I search to resolve this. Now I have faced following problems.
In my php.ini I didn't have php_oci8_11g.dll, I had php_oci8_12c.dl
And also had php_oci8_12c.dll in /ext.
So I downloaded php_oci8_11g.dll and mention extension = php_oci8_11g.dll.
Then try to run the code again but didn't work. Then in an article in here in stackoverflow I saw 32bit thin client is working because they had oracle 32bit and also xampp 32bit, But I have Oracle 11gXE 64bit and wamp 64bit also. So I have downloaded 64bit thin client.
Even I cannot see the php_oci8_11g in php extension pane.
php extension pane
Please help me with this what to do?
There are a few things to watch out for:
You need to make sure you have the same 32 or 64 bit architecture for all of: PHP, the webserver, the Oracle client libraries, and (if you are using Instant Client) also the MS VS Redistributable. (You did install the redistributable when you tried Instant Client? Check the Instant Client download page for details)
The version of the Oracle client libraries you want PHP to use (either in the Oracle XE installation, or from Instant Client) must be in PATH (and before any other Oracle version). Clashes between multiple version of libraries on Windows are hard to control. (Linux is easier...)
The version of the Oracle client libraries should be equal to, or greater than, the Oracle client version that the extension was compiled with E.g. php_oci8_12c was compiled with Oracle client 12c (but which will allow it to connect to older and newer database versions) so Oracle 12.1 or 12.2 client libraries must be in PATH (before other Oracle versions)
If you are downloading extensions from PECL, you need to make sure you get the thread safe, or non thread safe version of the DLL to match your PHP. And it must be for the same version of PHP you are using.

Connecting oracle 12c with php 7.1.7

I have oracle 12c R2 installed and xampp with php 7.1.7. Oracle 12c is 64 bit on my 64 bit windows 10 machine. But xampp is 32 bit.
How do I connect my oracle 12c with php?
Do I need to download oracle 12c 32 bit client and then use oci8?
If XAMPP is 32-bit, then you need 32-bit Oracle client libraries in your PATH since the PHP executable & OCI8 extension will be running as 32-bit.
If you also have a database on the same machine, make sure not to stuff up anything if you change PATH globally. You might need to change PATH just for XAMPP.
The Oracle Net layer between PHP OCI8 and the database will handle any 32-bit to 64-bit data conversions.

Php connect oracle on ARM

I need to use php to connect oracle database on an ARM mechine, but there are no released version of Oracle Instant Client for ARM linux.
How can I enable oci extension on the ARM linux ?
Or can I use something other than oci to connect Oracle ?
Any help or idea ?
Thanks.
Oracle Instant Client for Linux ARM64 is available from https://www.oracle.com/database/technologies/instant-client/linux-arm-aarch64-downloads.html

Categories