Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 29

...

Download and install the Oracle Instant Client on the PCR-360 application server. This is required before installing the PHP oracle driver (oci8).


If there is a previously installed version, you will need to remove it first

Code Block
#list installed oracle packages
rpm -qa | grep oracle*

# This command will vary depending on the version installed
rpm -e oracle-instantclientxx.x-sqlplus-xx.x.x.x.x-x.x86_6


Required to compile OCI8 PHP module:

Code Block
languagebash
# This command will vary depending on the version
oracle-instantclientxx.x-basic-xx.x.x.x.x-x.x86_64.rpm
oracle-instantclientxx.x-devel-xx.x.x.x.x-x.x86_64.rpm

Required to use the sqlplus interface:

Code Block
languagebash
# This command will vary depending on the version
oracle-instantclientxx.x-sqlplus-xx.x.x.x.x-x.x86_64.rpm

Download each and install each using rpm:

Code Block
languagebash
rpm -ivh# This command will vary depending on the version
yum install oracle-instantclient18instantclientxx.3x-basic-18xx.3x.0x.0x.0x-1x.x86_64.rpm
rpmyum -ivhinstall oracle-instantclient18instantclientxx.3x-devel-18xx.3x.0x.0x.0x-1x.x86_64.rpm
rpmyum -ivhinstall oracle-instantclient18instantclientxx.3x-sqlplus-18xx.3x.0x.0x.0x-1x.x86_64.rpm

Install OCI8 (for PHP < 7):

...

On the web server, apache needs the environment vars to run the OCI adapter

PHP56 LD library Configuration

Code Block
languagebash
# for php56
cd /home/oracle
vi .profile

Paste in this data. Be sure to adjust for install directory and version.

Code Block
languagebash
# This data will vary depending on the version
ORACLE_HOME=/usr/lib/oracle/18.3/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH

PHP72 LD library Configuration

Set up links the LD Library

Try this first, if it does not work, then try on f the alternative methods below

Add the library path to /etc/ld.so.conf.d/oracle-instantclient.conf:

Code Block
languagebash
/usr/lib/oracle/18.5/client64/lib

The next command is needed to create the new links & cache

Code Block
languagebash
# ldconfig

PHP72 Alternative LD library Configuration

Set up links for Apache

Code Block
#for# for php72, the environment vars must be set globally for apache
vi /etc/sysconfig/httpd

NOTE: Variables aliases will not work in these scripts. For Example:

PATH=$ORACLE_HOME/bin:$PATH

will not correctly load the environment variable. YOU MUST INCLUDE THE FULL PATH of the Oracle Client

Add the following to the end of the file

Code Block
languagebash
# OCI8 PHP Extension
# This data will vary depending on the version
ORACLE_HOME=/usr/lib/oracle/18.3/client64
LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib
export ORACLE_HOME
export LD_LIBRARY_PATH

Cron Jobs Alternative LD library Configuration (root access)

Code Block
# On some servers, it also necessary to add the environment vars to the global profile so it will work for root
vi /etc/profile.d/oci8.sh

NOTE: Variables aliases will not work in these scripts. For Example:

PATH=$ORACLE_HOME/bin:$PATH

will not correctly load the environment variable. YOU MUST INCLUDE THE FULL PATH of the Oracle Client

Add the following to the file. This change requires a server reboot reboot.

Code Block
languagebash
# OCI8 PHP Extension
# This data will vary depending on the version
ORACLE_HOME=/usr/lib/oracle/18.3/client64
LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib
export ORACLE_HOME
export LD_LIBRARY_PATH

...