This is part 2 of my installation instructions. This is my attempt to provide an updated and simplified reference. I am leaving Part 1 (http://www.gena01.com/forum/gena01_blog/installing_oracle_instant_client_and_making_it_work_with_php-t184.0.html) as is, because that part can also be useful.
NOTE: I am running Mandriva 2008 release. So most of the relevant packages and commands are for Mandriva.
Installation of Oracle Instant Client 11g is quite similar to 10g except that 11g requires libaio1 to be installed. urpmi libaio1
(as root) worked for me.
1. Download the Oracle Instant Client for Linux rpms from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html (http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html). The files that I am using and that you will need are:
Don't get basic-lite as this won't install by itself and you won't be able to build the Pecl OCI extension.
3. Install libaio1 urpmi libaio1
. NOTE: This is a new dependency for 11g.
4. Install those rpms to your linux system:
sudo rpm -ivh oracle-instantclient-*
NOTE: Here is where things get interesting. We need to prepare a couple of configuration files and you will need to become root in order to make those files usable on a global level.
5. You need to be root at this point:
6. Create /etc/oracle
directory as this is where we will store Oracle configuration files.
7. You will also need to grab a copy of tnsnames.ora
file either from your Oracle DBA or from another system.
copy tnsnames.ora /etc/oracle
8. Create a shell script that will initialize Oracle environment variables.
place the following into that file:
9. This is pretty much it. When you logout and log back in you should confirm that your environment variables are there using
. Also try out sqlplus to make sure it works and can connect to your Oracle database.
Simplified Pecl OCI8 installation:
1. # pear install pecl/oci8
2. You will be prompted with an option to provide instant client lib directory:
a. enter 1
- NOTE: Don't select autodetect as this never worked for me.
b. enter instantclient,/usr/lib/oracle/126.96.36.199/client/lib
c. press Enter to continue.
d. It should build and install the oci.so.
4. Create a file called /etc/php.d/999_oci.ini
and place the following line there:
5. vi /etc/sysconfig/http and add the following lines at the very end of the file
# Adding ORACLE Variables to the config status (cause during upgrade the httpd file got replaced :( )
6. service httpd restart
7. And you are done. Pull up a page that calls phpinfo() and confirm that oci8 is loaded in apache and that the environment variables are setup properly. You can also do "php -m" to see of php cli loads the module as well.
Also Rob Richard posted some of his notes battling SELinux while trying to install Oracle Instant Client and getting it to work with PHP. Read the article here (http://www.cdatazone.org/index.php?/archives/37-PHP,-Oracle-and-SELinux.html)
Let me know how it works out for you.