Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Tuesday, October 9, 2018

How to install oci8 instant client for Ubuntu Linux


  • First prerequirements are a working apache2 and php7.2 (Ubunti 18.04) environment.
  • Download the basic (like instantclient-basic-linux.x64-12.2.0.1.0.zip) and the sdk (instantclient-sdk-linux.x64-12.2.0.1.0.zip) package from the Oracle Website http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
  • Upload both files to your webserver, you can use WinSCP (windows) or rsync/scp (linux) for it
  • Unzip both files on server, in my case, you will get a new folder named "instantclient_12_2"
  • Create destination folder : mkdir /opt/oracle
  • Move and rename the instantclient folder: mv instantclient_12_2 /opt/oracle/instantclient
  • Change rights on folder: chown -R root:www-data /opt/oracle 
  • Check if you have the required packages for installing OCI8: apt install php7.2-dev php-pear build-essential libaio1 
  • Create necessary soft links: ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so; ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
  • Add instant client to ld config files : echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf
  • Update Dynamic Linker Run-Time Bindings : ldconfig
  • Now install OCI8 by pecl: pecl install oci8 
  • The OCI8 installation is asking you for the right folder: instantclient,/opt/oracle/instantclient
  • Add oci lib to the cli php config (console php): echo "extension = oci8.so" >>/etc/php/7.2/cli/php.ini
  • Add oci lib to the apache php config: echo "extension = oci8.so" >> /etc/php/7.2/apache2/php.ini
  • Set environment variables for the cli version (you will need to reboot the server after): echo "LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/environment echo "ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/environment
  • Set environement variables for the apache version: echo "export LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars; echo "export ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars 
  • Restart Apache: service apache2 restart or systemctl restart apache2 
  • You're done, now you can test your connection to the Oracle database

Update: If you're using Ubuntu 22.04 LTS with php 8.1, then then pecl install oci8-3.2.1

Wednesday, June 22, 2005

A busy day for a lazy man

Today is so full of meeting from nine to 5. meeting packed day. I have a meeting with Flinders University regarding courses ShahPutra want to offered here. They have strict requirements regarding students intake, softwares and technology that we have here.
"We are very Java" - said Dr. Janet, the IT Head
The course will be offered is Bac. Of Comp. Sc And IT. I, as an system administrator should provide them with softwares required to run the program such as Java, C/C++, A web server (Apache), JDK 1.4, J2EE, Linux OS, Oracle and also MySQL. Thank god I can download the free edition of Oracle on Oracle website. That will save cost as our boss like. Students can run Oracle server on their own PCs and do their work.

Last night I read the RAID manual for the 10th times. I realized that for RAID 5, I should make RAID 1 first and booting can be done from it. I have three disks that I could make RAID 5. It is no automatic process for this as many installers do not support configuring RAID 5 on first setup.

Slackware is still my Linux distro of choice although many of my friends run some sort of modern distro like Xandros, Mandrake (now Mandriva) and Fedora. I just think that it is easy for me since i first started using Linux with it. I learned many essential things on Linux by using Slackware and also my friends told me that it is similar but not the same as BSD family OS.

Nvidia new hotplug feature on Linux

 If you use nvidia driver for your GPU, you probably wonder why in some config, you can't hotplug your second monitor. You need to reboo...