install oci8 on ubuntu 22.04 /opt/lampp php7 and php8

 

Hi there. . . mostly

all of you will get file when activing oci8 on lampp server (xampp for linux version)

may be you will easily activing oci8 on php 5.4 by executing

sudo /opt/lampp/lampp oci8

and boooom it will active on phpinfo()

 

but you could be headache when activing oci8 on >=5.4 php 7.* and 8.*

when you run it sudo /opt/lampp/lampp oci8

it's not event appear on phpinfo()

 

Ok then,

I explore a couple day and found the formula. . .

this is it

you could copy this path and active your oci8 easily on php 7.* and 8.*

and it run under Ubuntu.22.04 any way :) 

check the steps below

Install lampp

1.

sudo chmod+x ./xampp-linux-x64-8.1.12-0-installer.run

2.

sudo ./xampp-linux-x64-8.1.12-0-installer.run

next until it's finish

btw this is my lampp path : /opt/lampp

3

ACTIVING OCI8

----------------------------
download instantclient-basic-linux.x64-21.7.0.0.0dbru.zip
download instantclient-sdk-linux.x64-21.7.0.0.0dbru.zip 

and unzip to /opt/oracle/instantclient_21_1
----------------------------

Use 'pecl install oci8' to install for PHP 8.1.

Use 'pecl install oci8-3.0.1' to install for PHP 8.0.

Use 'pecl install oci8-2.2.0' to install for PHP 7.

Use 'pecl install oci8-2.0.12' to install for PHP 5.2 - PHP 5.6.

Use 'pecl install oci8-1.4.10' to install for PHP 4.3.9 - PHP 5.1.


When you are prompted for the Instant Client location, enter the following:
Code: Select all
    instantclient,/opt/oracle/instantclient_21_1
 

or i prefer to use this method


1. Extract the package:

tar -zxf oci8-3.0.0.tgz
cd oci8-3.0.0

2. Prepare the package:

phpize

3. Configure the package, either using $ORACLE_HOME or Instant Client

./configure -with-oci8=shared,$ORACLE_HOME
 
or

./configure -with-oci8=shared,instantclient,/opt/oracle/instantclient_21_1

4. Install the package:

make install

5. If you get an error oci8_dtrace_gen.h: No such file or directory, it means PHP was built with DTrace Dynamic Tracing enabled. Re-run the configure and make commands after setting this environment variable:

$ export PHP_DTRACE=yes

6. Edit your php.ini file and add the line:
in my case i edited /opt/lampp/etc/php.ini
or find php.ini file by typing this command
 
php --ini
add this extension on php ini
maybe you will find your php ini full off dll's file like this event you use linux
but still
 
;extension=php_oci8_11g.dll  ; Use with Oracle 11g Instant Client    
;extension=php_openssl.dll    
;extension=php_pdo_firebird.dll    
;extension=php_pdo_mssql.dll    
;extension=php_pdo_mysql.dll    
;extension=php_pdo_oci.dll    
;extension=php_pdo_odbc.dll    
;extension=php_pdo_pgsql.dll    
;extension=php_pdo_sqlite.dll    
;extension=php_pgsql.dll    
 
 ;use this extension because oci8 generate file oci8.so for ubuntu
extension=oci8.so


7.restart your lampp

sudo /opt/lampp/lampp restart

so far you will find your oci8 active in your phpinfo()
 
 
 
but it finds null when you type this command

php --ri oci8

heheh yes. . . it make me confuse when  making this oci8 on Laravel
it found no oci8 extension. . .
 
add this magic part of

export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_1

 
cd ~
xed .bashrc

add this types
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_1

it will export automatic when the computer start

check your oci8 active

php --ri oci8