store | blogs | forums | twitter | facebook | wiki | downloads | support portal
Atomic Secure Linux
It is currently Tue Jan 22, 2019 8:55 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Yum oci8 extension install?
Unread postPosted: Sun Sep 14, 2008 2:28 pm 
Offline
Forum User
Forum User

Joined: Sat Apr 05, 2008 5:59 am
Posts: 30
I've just recently been looking into this again and I found out that Plesk stores all of the PHP extensions (modules) in this folder on x86_64 systems:
/usr/lib64/php/modules/

The mysql and other modules are listed there, but the oci8 module is not listed.

How can I get the oci8 php module onto my Plesk system?

I don't think I'll have too much trouble installing the Oracle Instant Client manually, but after I do that I'll need to enable the PHP oci8 module so it needs to be available and ready to go after I install the Oracle Instant Client.

On an xampp installation here on my Windows PC the module is available there in the ext folder even though it is not enabled in php.ini.

I'm guessing that I could download the Linux version of xampp and just copy over the oci8 module file onto the server and then add an ini file for it but I'm not sure if that will work yet.

It doesn't look like the oci8 extension is available for installation using your yum repository though, or is it?

Is there a proper way to install the oci8 extension on Plesk?


Top
 Profile  
Reply with quote  
 Post subject: HOWTO: OCI8 and Oracle Instant Client on Linux Plesk
Unread postPosted: Sun Sep 14, 2008 4:51 pm 
Offline
Forum User
Forum User

Joined: Sat Apr 05, 2008 5:59 am
Posts: 30
OK, I've accomplished my main goal for the day :-).

I've gotten the OCI8 PHP Module installed along with the Oracle Instant Client Library so now I can make calls to our Oracle database within PHP.

Awesome!

So this is what I needed to do.

Step 1: Download Oracle Instant Client Basic AND SDK Packages

To download Oracle Instant Client first go to:
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

And go to the download page for the version of Linux you are running (I'm running on x86_64, but you may be using x86) by clicking on the appropriate link (I clicked on "Instant Client for Linux x86-64").

The download page has two requirements: first you must accept the Oracle Terms, and second you're going to need an Oracle.com account (which is free, but you just need to register first). If you don't have an Oracle.com account yet, no worries as you'll be asked about it once you try and download a file.

You'll see a couple of different version for the Oracle Instant Client: Version 11.1.0.6.0, 10.2.0.4, etc.). Now I'm not 100% certain, but I am pretty sure that the 11.1.0.6.0 version dropped support for Oracle 9i (since I remember trying it out on my Windows PC with PHP and it couldn't connect to our database) so I decided to use 10.2.0.4 instead.

I downloaded both the Basic and the SDK Instant Client Packages in RPM format (since we have a Redhat server).

I do not know if you can use a wget to download the files or not, but what I did was download them both to my local Windows PC, and then SFTP them over to my home directory on the Plesk server.

Step 2: Install the Oracle Instant Client Basic and SDK Packages

With an RPM, the installation was fairly simple, and I am pretty sure installing from the zip file would be almost as easy (if somebody knows the procedure for the zip file it'd be nice of you to add a comment).

To install the Basic and SDK packages from SSH just go into your home directory (or wherever you placed the files) and then type in:
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm
rpm -ivh oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm

That will create a few different folders, but specifically the Oracle Instant Client files will be installed here:
/usr/lib/oracle/10.2.0.4/client64/lib

You've now installed the Oracle Instant Client Basic Package and the SDK which you'll need to install the PHP OCI8 module.

Step 3: Download the OCI8 Extension from PECL

With PECL you can go about this a couple of different ways, but I just went to the OCI8 Extension Page:
http://pecl.php.net/package/oci8

And then downloaded the latest version of the extension to my local PC.

Then I created a folder named "oci8" on my Desktop and used 7-zip to extract the contents of the tgz file into the oci8 folder.

So in the oci8 folder on your Desktop you should have the following:
A package.xml file
A oci8-1.3.4 folder with some files inside.

Step 4: Build the PHP OCI8 Module

Now copy the oci8 folder to your home directory using a SFTP program like WinSCP.

I then followed this person's instructions, which I'll be going over here (I just wanted to provide some of the source for my success):
http://www.php.net/manual/en/oci8.setup.php#83323

Using SSH go into the oci8 folder that you just SFTP'd into your home directory and run the following command:
pecl build

I'm trying to remember exactly what happened right now from memory, but I am pretty sure at this point that you will be prompted for the location of ORACLE_HOME. It really doesn't matter what you enter at this point though because it really doesn't take your input as it should so just press enter and let it take it's course.

After that's done run the following command:
cd oci8-1.3.4

and then type in:
./configure --with-oci8=instantclient,/usr/lib/oracle/10.2.0.4/client64/lib
and push enter.

You'll see quite a bit of output but you shouldn't run into any errors (I initially ran into an SDK issue because I hadn't download the Oracle Instant Client SDK Package).

Once that has completed type in the following:
make

Which I suppose creates the oci8.so file.

And you've successfully built the oci8 PHP module :-).

Step 5: Install the OCI8 PHP Module

Now that everything has been built, there should be a new folder named "modules" in the oci8-1.3.4 folder.

cd into the modules directory and if you do an ls to see the folder contents you will see the oci8.so module. What you want to do now is copy it into the location where your other PHP modules are stored.

In my case this location is:
/usr/lib64/php/modules/

So to do the copy from within the modules folder type in:
cp oci8.so /usr/lib64/php/modules

Next, you have to add an .ini entry to your php.d folder so that php will try and load this extension when it starts up.

Go to your php.d folder by typing in:
cd /etc/php.d

Then you are going to want to create a new oci8.ini file which you can do by typing in:
vi oci8.ini

First press "i" on your keyboard to change the vi text editor to insert mode so that you can start typing and then type in:
; Oracle Instant Client Shared Object
extension=oci8.so

Now press ":" (colon) and then "w" to write your changes to disk and then press ":" and then "q" to quit vi and go back to the command line. If you do an ls at this point you should see the new oci8.ini there.

You've successfully installed the OCI8 PHP Module into PHP, just one more step!

Step 6: Restart Apache to Load New Changes

To restart Apache all you need to do is type in:
/etc/init.d/httpd restart

Everything should be working and the OCI functions should be available to your PHP scripts now. If you'd like to test further, you can create a phpinfo file (and then use Ctrl+F to do a search for oci8 in the output) and also try using the OCI functions by making a connection to your database and running a query.


Top
 Profile  
Reply with quote  
 Post subject:
Unread postPosted: Mon Sep 15, 2008 9:01 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 8329
Location: earth
A follow up here, I don't include the oracle module because the license doesn't allow me to redistribute it.


Top
 Profile  
Reply with quote  
 Post subject: Thanks Scott
Unread postPosted: Mon Sep 15, 2008 9:40 am 
Offline
Forum User
Forum User

Joined: Sat Apr 05, 2008 5:59 am
Posts: 30
Yeah, I didn't really understand this fully until yesterday.

I remember that you had told me that, but then when I found out that I needed to install the OCI8 extension still I wondered why that module wasn't available in your repository.

Then, as I downloaded it myself and began trying to install it I realized why not being able to redistribute the Oracle Instant Client Library makes it difficult to install the OCI8 extension: during creation of the module, it asks for the location of the Oracle Instant Client Library.

In other words, the Oracle Instant Client Libraries need to be installed prior to installing the OCI8 extension, and since you can't redistribute it, and you can't really ensure that users will already have it installed, there's no real sense in you making a package to help install it.

But I'm glad it's working :-).


Top
 Profile  
Reply with quote  
 Post subject:
Unread postPosted: Mon Sep 15, 2008 10:41 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 8329
Location: earth
Yup, great post though. If someone else needs to do this in the future this is as good as a tutorial as Ive seen


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group