Sunday, November 21, 2010

Installing oci8 on Centos

Today I have the inclination to resume one of my postponed to-dos, that is to install Oracle instant client and php extension oci8 in two production servers.

references :
http://shamuntoha.wordpress.com/2010/04/12/centos-oracle-php-database-connect-oci-instantclient-oci8/

http://ubuntuforums.org/showthread.php?t=92528

http://www.jagsiacs.co.uk/node/77

Overview
The basic steps are, download and extract basic instant client and SDK instant client. Then do a pecl install oci8 to download and compile oci8 extension. There are few issues I encountered when installing php oci8 extension.
  1. pear tried to connect directly to pear server. Must set http_proxy using pear config-set command.
  2. missing links. Because I downloaded zip files, and not rpms, there are few missing links when trying to link oci8 with instant client. The solution is to create them manually
  3. intermittent compilation problem. One of two compile result in an error, even with exactly the same arguments and environment condition. This means, if it fails, retry at least once, there is a chance that the second compile will work smoothly.
  4. SElinux issues. Must do some chcon to allow the execution of instant client libraries. See reference #3.
Pear proxy configuration
pear config-set http_proxy http://10.x.x.x:8080

Missing link solution
Do these commands when current working directory is where the oracle instant client library were extracted.
ln -s libclntsh.so.10.1 libclntsh.so
ln -s libocci.so.10.1 libocci.so


Selinux issue solution
I do these commands to allow execution of oracle libraries from PHP environment :
chcon system_u:object_r:textrel_shlib_t *.so
chcon system_u:object_r:textrel_shlib_t *.10.1

But these might not be enough, I only phpinfo results to confirm that oci8 is indeed loaded by PHP environment. Stay tuned for more info after we try this configuration.

No comments: