Introduction

The PHP extension oci8 is not part of EasyApache 4. To install the oci8 extension, you'll need to satisfy the oci8 dependencies. Once this has been resolved, you'll need to use PECL to install the module.

 

Procedure

The following procedure will work on all Ubuntu operating systems supported by cPanel.

  1. Create a directory for the Oracle software to live:

    mkdir -p /opt/oracle
    cd /opt/oracle
  2. Download the current version of InstantClient:

    wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
  3. Unzip the archives:

    unzip -o instantclient-basic-linuxx64.zip ; unzip -o instantclient-sdk-linuxx64.zip
  4. Create the required config file:

    echo /opt/oracle/instantclient_23_6/ > /etc/ld.so.conf.d/oracle-instantclient.conf
  5. Run ldconfig to update the library cache:

    ldconfig
  6. Run PECL for the PHP version you want to install to:

    ea-phpXX-pecl install oci8
  7. The install procedure will ask for the path to the libraries. Provide the following path:

    instantclient,/opt/oracle/instantclient_23_6
  8. The installation is complete. You can verify it is loaded by locating the pecl library file or querying the version of PHP for loaded modules and searching for "ioc."

    [root@server /opt/oracle]# grep -rs oci8 /opt/cpanel/ea-phpXX/root/etc/
    /opt/cpanel/ea-phpXX/root/etc/php.d/zzzzzzz-pecl.ini:extension="oci8.so"
    [root@server /opt/oracle]# ea-phpXX -i | grep oci
    oci8
    oci8.connection_class => no value => no value
    oci8.default_prefetch => 100 => 100
    oci8.events => Off => Off
    oci8.max_persistent => -1 => -1
    oci8.old_oci_close_semantics => Off => Off
    oci8.persistent_timeout => -1 => -1
    oci8.ping_interval => 60 => 60
    oci8.prefetch_lob_size => 0 => 0
    oci8.privileged_connect => Off => Off
    oci8.statement_cache_size => 20 => 20

 

Additional resources

Oracle Instant Client Download page

oci8 | PHP pecl