Viedumu Vietne ar Sandi


Php and Oci8

Filed under: Tech — Sandis @ 19:44

Operation system: CentOS 5.2 (Red Hat).
Mission: install php and php_oci8 with as less pain as possible.
Reason, why this information is better than other found in Google: I had to do many searches in Google, I didn’t find everything in one place.
Why I need it: To save how-to, if this happens again.

As the installers I used yum, rpm and pecl (installed already).

Updated: I was blind, please read after the P.S.

yum install php #this command installs php
yum install php-devel # php-devel is needed to compile oci8 later
yum install php-pear # php-pear installation, needed for oci8 later

Now, for the oci8 you need Oracle Instant Client. Please download 2 packages from ““: InstantClient-Basic and InstantClient-SDK. Put those 2 rpm’s on your server and run “rpm -i “.

As a result you will have Instant Client installed, somewhere inside /usr/lib/oracle//client.
I did put this path into Environmental values of OS: edited /etc/profile and /etc/init.d/httpd to add such lines at the end of those files:
LD_LIBRARY_PATH=/usr/lib/oracle//client/lib; EXPORT LD_LIBRARY_PATH

The value of NLS_LANG, of course, depends on what language you want to use.

Now, the Php and Instant Client are installed, proceeding with oci8. Please download PECL package of oci8 from here:

Remember, where you will extract this archive, there the permanent library will be set, so choose wisely.
tar -xf oci*.tgz # the folder oci8-* will be created and all files extracted there
cd oci8-* # change directory to oci8-*. I suggest reading README in that folder, because all further commands are from there.
phpize # phpize
./configure –with-oci8=shared,instantclient,/usr/lib/oracle//client/lib
make install # install the oci

Now, edit the /etc/php.ini and add this line: “”.

Hope I didn’t forgot to add something.
Run /etc/init.d/httpd restart and enjoy.

P.S. I tend notice, that programms and their support information changes with time and the work environment. So even, if I have successfully installed using these current commands now, tomorrow that may not work.

!Actually, there is only one command necessary.

pecl install oci8

You should know where your instantclient keeps its libraries. When pecl asks, tell him that you will compile with instantclient: “instantclient, /usr/lib/oracle//client/lib” (or your own path).

Komentēt »

Vēl nav komentāru.

RSS feed for comments on this post. TrackBack URI


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Mainīt )

Twitter picture

You are commenting using your Twitter account. Log Out / Mainīt )

Facebook photo

You are commenting using your Facebook account. Log Out / Mainīt )

Google+ photo

You are commenting using your Google+ account. Log Out / Mainīt )

Connecting to %s blogs.

%d bloggers like this: