Las ideas no duran mucho, hay que hacer algo con ellas

juliorestrepo.wordpress.com desde el año 2008

Integrar Apache, PHP y Oracle mediante la Libreria OCI8 – Ubuntu 20.04

Este procedimiento permite configurar tu servidor web Apache para consultar una base de datos Oracle mediante PHP en un servidor Ubuntu Linux.

Pre-requisitos:

Tener instalado APACHE y PHP en tu servidor

Esta integración se logra mediante una librería llamada OCI (Oracle Call Interface), la cual está excluida de los Repositorios de Ubuntu (aptitude o apt-get no podrán usarse para su instalación) y debe instalarse haciendo uso de un repositorio bastante amigable suministrado por PHP llamado PEAR (Acrónimo de PHP Extension and Application Repository)

Tomado de https://gist.github.com/eSkiSo/781269c79b4dd740e90fcc059c1985ae con adaptaciones y mejoras realizadas por Julio Restrepo

Paso 1: Instalar los paquetes PHP-PEAR , PHP-DEV , BUILD-ESSENTIAL y LIBAIO1

# apt-get install php-dev php-pear build-essential libaio1

libaio1 is already installed at the requested version (0.3.112-5)
The following NEW packages will be installed:
autoconf{a} automake{a} autopoint{a} autotools-dev{a} binutils{a} binutils-common{a} binutils-x86-64-linux-gnu{a}
build-essential cpp{a} cpp-9{a} debhelper{a} dh-autoreconf{a} dh-strip-nondeterminism{a} dpkg-dev{a} dwz{a} fakeroot{a} g++{a} g++-9{a} gcc{a} gcc-9{a} gcc-9-base{a} gettext{a} intltool-debian{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a} libarchive-cpio-perl{a} libarchive-zip-perl{a} libasan5{a} libatomic1{a} libbinutils{a} libc-dev-bin{a} libc6-dev{a} libcc1-0{a} libcroco3{a} libcrypt-dev{a} libctf-nobfd0{a} libctf0{a} libdebhelper-perl{a} libdpkg-perl{a} libfakeroot{a} libfile-fcntllock-perl{a} libfile-stripnondeterminism-perl{a} libgcc-9-dev{a} libgomp1{a} libisl22{a} libitm1{a} liblsan0{a} libltdl-dev{a} libmail-sendmail-perl{a} libmpc3{a} libpcre2-16-0{a} libpcre2-32-0{a} libpcre2-dev{a} libpcre2-posix2{a} libquadmath0{a} libssl-dev{a} libstdc++-9-dev{a} libsub-override-perl{a} libsys-hostname-long-perl{a} libtool{a} libtsan0{a} libubsan1{a} linux-libc-dev{a} m4{a} make{a} manpages-dev{a} php-dev php-pear php7.4-dev{a} pkg-php-tools{a} po-debconf{a} shtool{a} 0 packages upgraded, 73 newly installed, 0 to remove and 8 not upgraded.
Need to get 50.9 MB of archives. After unpacking 223 MB will be used.
Do you want to continue? [Y/n/?]



Setting up php-dev (2:7.4+75) …
Setting up dh-autoreconf (19) …
Setting up debhelper (12.10ubuntu1) …
Setting up pkg-php-tools (1.38) …
Processing triggers for libc-bin (2.31-0ubuntu9.2) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for install-info (6.7.0.dfsg.2-5) …

Paso 2: Descargar el cliente de Oracle desde la URL https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

En la siguiente imagen se muestra el procedimiento para obtener los vínculos de descarga del Basic Package y el SDK Package, los cuales copiaremos y pegaremos en un Bloc de Notas para posteriormente ejecutar un WGET para realizar estas descargas directo en el servidor (así nos ahorramos la transferencia vía SCP con Filezilla u otro cliente)

Luego de haber copiado y pegado los vínculos de descarga en un Bloc de Notas, procederemos a realizar un wget desde la consola de nuestro servidor para descargarlos directamente en el sistema operativo Linux

Descarga del Basic Package

$ wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
–2021-11-08 13:55:05– https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
Resolving download.oracle.com (download.oracle.com)… 23.192.208.88
Connecting to download.oracle.com (download.oracle.com)|23.192.208.88|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 79386308 (76M) [application/zip]
Saving to: ‘instantclient-basic-linux.x64-21.4.0.0.0dbru.zip’

instantclient-basic-linux.x64-21. 100%[===========================================================>] 75.71M 77.4MB/s in 1.0s

2021-11-08 13:55:06 (77.4 MB/s) – ‘instantclient-basic-linux.x64-21.4.0.0.0dbru.zip’ saved [79386308/79386308]

Descarga del SDK Package

$ wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
–2021-11-08 13:55:29– https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
Resolving download.oracle.com (download.oracle.com)… 23.192.208.88
Connecting to download.oracle.com (download.oracle.com)|23.192.208.88|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1000964 (978K) [application/zip]
Saving to: ‘instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip’

instantclient-sdk-linux.x64-21.4. 100%[===========================================================>] 977.50K 6.03MB/s in 0.2s

2021-11-08 13:55:29 (6.03 MB/s) – ‘instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip’ saved [1000964/1000964]

Paso 3: Descomprimir los paquetes descargados y ubicarlos literalmente en /usr/lib/oracle/21.1/client64/lib

Pre-requisito: Tener instalado UNZIP

# aptitude install unzip
The following NEW packages will be installed:
unzip
0 packages upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 169 kB of archives. After unpacking 593 kB will be used.
Get: 1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 unzip amd64 6.0-25ubuntu1 [169 kB]
Fetched 169 kB in 0s (7462 kB/s)
Selecting previously unselected package unzip.
(Reading database … 73301 files and directories currently installed.)
Preparing to unpack …/unzip_6.0-25ubuntu1_amd64.deb …
Unpacking unzip (6.0-25ubuntu1) …
Setting up unzip (6.0-25ubuntu1) …
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for man-db (2.9.1-1) …

3a Descomprimir el Basic Package

# unzip instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
Archive: instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
inflating: instantclient_21_4/adrci
inflating: instantclient_21_4/BASIC_LICENSE
inflating: instantclient_21_4/BASIC_README
inflating: instantclient_21_4/genezi

3b Descomprimir el SDK Package

# unzip instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
Archive: instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
creating: instantclient_21_4/sdk/
creating: instantclient_21_4/sdk/include/
inflating: instantclient_21_4/sdk/include/xa.h
inflating: instantclient_21_4/sdk/include/oraxsd.hpp

3c Crear el directorio donde hospedaremos los archivos descomprimidos

# mkdir -p /usr/lib/oracle/21.1/client64/lib

3d Trasladar los archivos hacia la ruta creada. Nota: El comando incluye 21_4 y 21.1 . Es coherente. No hay inconsistencia. Debe realizarse de esa manera.

# mv instantclient_21_4 /usr/lib/oracle/21.1/client64/lib

3e Verificar que todo haya quedado OK

# ls -l /usr/lib/oracle/21.4/client64/lib
total 245488
-rw-r–r– 1 root root 5780 Oct 6 07:10 BASIC_LICENSE
-rw-r–r– 1 root root 1632 Oct 6 07:10 BASIC_README
-rw-r–r– 1 root root 5780 Oct 6 07:10 SDK_LICENSE
-rw-rw-r– 1 root root 1626 Oct 6 07:10 SDK_README

Paso 4: Algunos comandos previos a la instalación de la Librería OCI8

4a

# echo /usr/lib/oracle/21.1/client64/lib > /etc/ld.so.conf.d/oracle.conf

4b

# ldconfig

4c

# pecl channel-update pecl.php.net

Updating channel «pecl.php.net»
Update of Channel «pecl.php.net» succeeded

Paso 5: Instalación de la Librería OCI8 mediante el comando PECL (PHP Extension Community Library)

Si tienes PHP 8, debes usar el comando «pecl install oci8»

Si tienes PHP 7.4, debes usar el comando «pecl install oci8-2.2.0»

Antes de continuar, comprueba tu versión de PHP mediante el comando «php -v»

# php -v
PHP 7.4.3 (cli) (built: Oct 25 2021 18:20:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Si intentas ejecutar «pecl install oci8» teniendo PHP 7.4, mostrará el siguiente error:

# pecl install oci8

Notice: Trying to access array offset on value of type bool in PEAR/REST.php on line 187
PHP Notice: Trying to access array offset on value of type bool in /usr/share/php/PEAR/REST.php on line 187
pecl/oci8 requires PHP (version >= 8.0.0), installed version is 7.4.3
No valid packages found
install failed

A continuación realicemos la instalación para PHP 7.4 (el incluido nativamente en Ubuntu 20.04)

No tener miedo. Aunque la salida en pantalla es bastante extensa (comparada con una instalación vía aptitude o apt-get) se trata de un proceso completamente automatizado… si todo sale bien, al final mostrará el mensaje «Build process completed successfully. You should add «extension=oci8.so» to php.ini «

# pecl install oci8-2.2.0

downloading oci8-2.2.0.tgz …
Starting to download oci8-2.2.0.tgz (196,449 bytes)
…………………………………..done: 196,449 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
Please provide the path to the ORACLE_HOME directory. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling with Oracle Instant Client [autodetect] :
building in /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0
running: /tmp/pear/temp/oci8/configure –with-php-config=/usr/bin/php-config –with-oci8
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking for a sed that does not truncate output… /usr/bin/sed
checking for pkg-config… no
checking for cc… cc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… no
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether cc accepts -g… yes
checking for cc option to accept ISO C89… none needed
checking how to run the C preprocessor… cc -E
checking for icc… no
checking for suncc… no
checking for system library directory… lib
checking if compiler supports -R… no
checking if compiler supports -Wl,-rpath,… yes
checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking target system type… x86_64-pc-linux-gnu
checking for PHP prefix… /usr
checking for PHP includes… -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib
checking for PHP extension directory… /usr/lib/php/20190902
checking for PHP installed headers prefix… /usr/include/php/20190902
checking if debug is enabled… no
checking if zts is enabled… no
checking for gawk… gawk
checking for Oracle Database OCI8 support… yes, shared
checking PHP version… 7.4.3, ok
checking OCI8 DTrace support… no
checking size of long int… 8
checking checking if we’re on a 64-bit platform… yes
configure: WARNING: OCI8 extension: ORACLE_HOME is not set, looking for default Oracle Instant Client instead
checking Oracle Instant Client directory… /usr/lib/oracle/21.1/client64/lib
checking Oracle Instant Client SDK header directory… /usr/lib/oracle/21.1/client64/lib/sdk/include
checking Oracle Instant Client library version compatibility… 21.1
checking for a sed that does not truncate output… /usr/bin/sed
checking for ld used by cc… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for /usr/bin/ld option to reload object files… -r
checking for BSD-compatible nm… /usr/bin/nm -B
checking whether ln -s works… yes
checking how to recognize dependent libraries… pass_all
checking dlfcn.h usability… yes
checking dlfcn.h presence… yes
checking for dlfcn.h… yes
checking the maximum length of command line arguments… 1572864
checking command to parse /usr/bin/nm -B output from cc object… ok
checking for objdir… .libs
checking for ar… ar
checking for ranlib… ranlib
checking for strip… strip
checking if cc supports -fno-rtti -fno-exceptions… no
checking for cc option to produce PIC… -fPIC
checking if cc PIC flag -fPIC works… yes
checking if cc static flag -static works… yes
checking if cc supports -c -o file.o… yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… no

creating libtool
appending configuration tag «CXX» to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8.c -o oci8.lo
mkdir .libs
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8.c -fPIC -DPIC -o .libs/oci8.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_lob.c -o oci8_lob.lo
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_lob.c -fPIC -DPIC -o .libs/oci8_lob.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_statement.c -o oci8_statement.lo
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_statement.c -fPIC -DPIC -o .libs/oci8_statement.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_collection.c -o oci8_collection.lo
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_collection.c -fPIC -DPIC -o .libs/oci8_collection.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_interface.c -o oci8_interface.lo
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_interface.c -fPIC -DPIC -o .libs/oci8_interface.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=compile cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_failover.c -o oci8_failover.lo
cc -I. -I/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/oci8/oci8_failover.c -fPIC -DPIC -o .libs/oci8_failover.o
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/include -I/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo oci8_failover.lo -Wl,-rpath,/usr/lib/oracle/21.1/client64/lib -L/usr/lib/oracle/21.1/client64/lib -lclntsh
cc -shared .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o .libs/oci8_failover.o -L/usr/lib/oracle/21.1/client64/lib -lclntsh -Wl,-rpath -Wl,/usr/lib/oracle/21.1/client64/lib -Wl,-soname -Wl,oci8.so -o .libs/oci8.so
creating oci8.la
(cd .libs && rm -f oci8.la && ln -s ../oci8.la oci8.la)
/bin/bash /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/libtool –mode=install cp ./oci8.la /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules
cp ./.libs/oci8.so /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules/oci8.so
cp ./.libs/oci8.lai /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules/oci8.la

PATH=»$PATH:/sbin» ldconfig -n /tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules

Libraries have been installed in:
/tmp/pear/temp/pear-build-rootwkucgJ/oci8-2.2.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:

add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution

add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking

use the `-Wl,–rpath -Wl,LIBDIR’ linker flag

have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.

Build complete.
Don’t forget to run ‘make test’.

running: make INSTALL_ROOT=»/tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0″ install
Installing shared extensions: /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr/lib/php/20190902/
running: find «/tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0» | xargs ls -dils
264003 4 drwxr-xr-x 3 root root 4096 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0
264034 4 drwxr-xr-x 3 root root 4096 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr
264035 4 drwxr-xr-x 3 root root 4096 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr/lib
264036 4 drwxr-xr-x 3 root root 4096 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr/lib/php
264037 4 drwxr-xr-x 2 root root 4096 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr/lib/php/20190902
264033 936 -rwxr-xr-x 1 root root 956808 Nov 8 14:01 /tmp/pear/temp/pear-build-rootwkucgJ/install-oci8-2.2.0/usr/lib/php/20190902/oci8.so

Build process completed successfully
Installing ‘/usr/lib/php/20190902/oci8.so’
install ok: channel://pecl.php.net/oci8-2.2.0
configuration option «php_ini» is not set to php.ini location
You should add «extension=oci8.so» to php.ini

#

Paso 6: Agregar la Librería OCI8.so a la lista de extensiones del archivo CLI del PHP.ini

Es igual que lo que verán en el Paso 7, pero aquí carece de espacios separando las palabras.

# echo «extension=oci8.so» >> /etc/php/7.4/cli/php.ini

Paso 7: Agregar la Librería OCI8.so a la Carpeta de Módulos Disponibles de PHP.

Es igual que lo visto en el Paso 6, pero aquí lleva espacios separando las palabras.

# echo «extension = oci8.so» >> /etc/php/7.4/mods-available/oci.ini

Paso 8: Reiniciar APACHE

# systemctl restart apache2

Paso 9 (Final): Verificando que el Módulo OCI8 haya quedado activo en PHP

# php -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.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

#

Un comentario el “Integrar Apache, PHP y Oracle mediante la Libreria OCI8 – Ubuntu 20.04

  1. sofia
    febrero 15, 2023

    Hola, seguí todos los pasos, se instalo correctamente el oci para php 7.4 pero a la hora de verificar que el modulo haya quedado actvo en php no aparece y en la página web que estoy haciendo aparece: llamada a la función indefinida oci_connect()

Deja una respuesta

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: