Oracle can be a real pain to get installed on your server, however, since they’ve created a Debian (Sarge and later) repository it is a lot easier. Getting it to work with PHP (in this case version 5) will be another story which this small how-to will describe.
First, add the Debian repository to your
/etc/apt/sources.list by adding the following two lines at the bottom of the file;
# Oracle XE deb http://oss.oracle.com/debian unstable main non-free
Afterwards run the following chain of commands as root;
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add - apt-get update apt-get install oracle-xe
Now Oracle is installed on your system and it will ask you to run
/etc/init.d/oracle configure first.
Since this was the easy part let’s continue to the hard part; enabling Oracle in PHP.
First download the basic instantclient and the instantclient SDK zip files from www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html.
Create a directory in
/usr/lib/oracle/xe/app/oracle/product/10.2.0 and name it
Unzip the contents of the basic instantclient here and create another directory named
sdk, in this one you should unzip the instantclient SDK.
When done, use the following commands:
cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/instantclient ln -s libclntsh.so.10.1 libclntsh.so ln -s libocci.so.10.1 libocci.so
Now grab the following packages from the apt repository;
apt-get install php-pear apt-get install php5-dev
Oh yes, almost there! Create the oci8 module using
pecl using the command
pecl install oci8 and wait till it asks for the location of the instantclient. Then supply the following command
hit <enter> and wait yet again till it finishes building the
oci8.so file. When ready, edit
php.ini and add
extension=oci8.so to the dynamic extension block, reload Apache and enjoy your Oracle PHP installation!
As a last step you may wish to run
apt-get clean so the Oracle Debian package will be cleared from the system, it’s a pretty big package after all!
If you want to access the web interface remotely (and) in a safe way; you can configure PuTTY to tunnel the connection for you.
Create a new session and give it a name, e.g.
!apex. Go to
Connection > SSH > Tunnels and add a new forwarded port; use
8888 for the source port and
127.0.0.1:8080 as the destination (or any other destination port depending on your configuration). Click add, save your session and login to the box. Change the proxy settings of your browser to
localhost:8888 and make sure it’ll use this for internal addresses to. Open up a web page to
http://127.0.0.1:8080/apex/ and you should be asked to login.