Table of Contents | ||||
---|---|---|---|---|
|
Oracle version 12.1.0.2.0 (12c r1) or greater is required.
Install Notes
- Schema names are case sensitive as of Oracle 12 and need to be in all caps in the PCR-360 config file to avoid errors
- Included in the installation package is a file named oracle-create.sql; log into the main schema and execute these commands. Also included is a file named oracle-create-metadata.sql; log into the metadata schema and execute these commands.
...
Installation
We highly recommend installing Oracle on a dedicated database server. To communicate with Oracle on that server completing this installation will require the username, password, hostname, port (e.g. 1521) and SID.
Download and install the the Oracle Instant Client on 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
...
.
...
Required to compile OCI8 PHP module:
Code Block | ||
---|---|---|
| ||
# 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 | ||
---|---|---|
| ||
# 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 | ||
---|---|---|
| ||
# This command will vary depending on the version yum installrpm -ivh oracle-instantclientxxinstantclient12.x1-basic-xx12.x1.x0.x2.x0-x1.x86_64.rpm yumrpm install-ivh oracle-instantclientxxinstantclient12.x1-devel-xx12.x1.x0.x2.x0-x1.x86_64.rpm yumrpm install-ivh oracle-instantclientxxinstantclient12.x1-sqlplus-xx12.x1.x0.x2.x0-x1.x86_64.rpm |
Install OCI8 (for PHP < 7):
Code Block | ||
---|---|---|
| ||
pecl install oci8-2.0.12 |
Install OCI8 for PHP 7+
Code Block | ||
---|---|---|
| ||
yum -y install php72-php-oci8 |
...
sqlplus Configuration
On the web server, apache needs the environment vars to run the OCI adapter
PHP56 LD library Configuration
Oracle database server:
Code Block | ||
---|---|---|
| ||
# for php56
cd /home/oracle
vi .profile |
Paste in this data. Be sure to adjust for install directory and version.
Code Block | |||||
---|---|---|---|---|---|
| # This data will vary depending on the version
| ||||
ORACLE_HOME=/usr/lib/oracle/1812.31/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 | ||
---|---|---|
| ||
/usr/lib/oracle/18.5/client64/lib |
The next command is needed to create the new links & cache
Code Block | ||
---|---|---|
| ||
# ldconfig |
PHP72 Alternative LD library Configuration
Set up links for Apache
Code Block |
---|
# 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
Save the file and enter the following command in the terminal:
Code Block | ||
---|---|---|
| ||
# 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 | ||
---|---|---|
| ||
# 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 |
source .profile |
User Configuration
On the Oracle database server, create two Oracle users and two schema. These will hold the application data and the application metadata, the examples below use pcr360_prod and pcr360_prod_metadata.
...
Code Block | ||
---|---|---|
| ||
sudo su
su - oracle
sqlplus / as sysdba |
Grant the required permissions to the users. Be sure to modify the passwords.
Code Block | |||||
---|---|---|---|---|---|
| ALTER SESSION SET NLS_LENGTH_SEMANTICS = 'CHAR';
| ||||
CREATE USER pcr360_prod IDENTIFIED BY password1; CREATE USER pcr360_prod_metadata IDENTIFIED BY password2; GRANT CREATE TABLE TO pcr360_prod; GRANT CREATE SEQUENCE TO pcr360_prod; GRANT CREATE ANY INDEX TO pcr360_prod; GRANT CREATE PROCEDURE TO pcr360_prod; GRANT CREATE VIEW TO pcr360_prod; GRANT CREATE SESSION TO pcr360_prod; GRANT ALTER ANY TABLE TO pcr360_prod; GRANT ALTER SESSION TO pcr360_prod; GRANT LOCK ANY TABLE TO pcr360_prod; GRANT DROP ANY SEQUENCE TO pcr360_prod; GRANT SELECT ON V_$SESSION TO pcr360_prod; GRANT UNLIMITED TABLESPACE TO pcr360_prod; GRANT CREATE TABLE TO pcr360_prod_metadata; GRANT CREATE SEQUENCE TO pcr360_prod_metadata; GRANT CREATE ANY INDEX TO pcr360_prod_metadata; GRANT CREATE PROCEDURE TO pcr360_prod_metadata; GRANT CREATE VIEW TO pcr360_prod_metadata; GRANT CREATE SESSION TO pcr360_prod_metadata; GRANT ALTER ANY TABLE TO pcr360_prod_metadata; GRANT ALTER SESSION TO pcr360_prod_metadata; GRANT LOCK ANY TABLE TO pcr360_prod_metadata; GRANT DROP ANY SEQUENCE TO pcr360_prod_metadata; GRANT SELECT ON V_$SESSION TO pcr360_prod_metadata; GRANT UNLIMITED TABLESPACE TO pcr360_prod_metadata; |
...