Skip to content

Instantly share code, notes, and snippets.

@merolhack
Last active January 24, 2024 15:01
Show Gist options
  • Save merolhack/6d289ed7e078813d741c to your computer and use it in GitHub Desktop.
Save merolhack/6d289ed7e078813d741c to your computer and use it in GitHub Desktop.
REHL(CentOs & Oracle Linux) 6: Instalación de OCI8

High performance PHP applications with Oracle Database

The PHP OCI8 2.0 extension for Oracle Database is now "production" status. The source code is included in the latest PHP versions and is also available on PECL to update your OCI8 extension in PHP 5.2 and later versions. The extension compiles with Oracle 10.2 or later client libraries. Oracle's standard cross-version database connectivity applies, allowing PHP to connection to multiple versions of Oracle Database.

PHP OCI8 is part of the PHP open source project. It is maintained by Oracle, and is under active development.

PHP OCI8

# Descargar de la siguiente URL los Instant Client de Oracle
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
# Instalar Instant Client Basic
rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
# Instalar Instant Client Devel
rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
# Generar variables de entorno
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.1
export NLS_LANG=SPANISH_MEXICO.WE8MSWIN1252
# Instalar módulo de PHP para la conexión con Oracle
yum --enablerepo=remi install php-oci8 -y
# Instalar re2c requerido para la compilación de OCI8
yum --enablerepo=remi install re2c -y
# Instalar OCI8 mediante PECL
pecl install oci8
# Agregar variable NLS_LANG a la configuración de Apache
nano /etc/sysconfig/httpd
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.1
export NLS_LANG=SPANISH_MEXICO.WE8MSWIN1252
# Habilitar booleano para permitir a Apache a abrir sockets
setsebool -P httpd_can_network_connect=1
# Habilitar booleano para execmem/execstac
setsebool -P httpd_execmem 1
# Reiniciar Apache
service httpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment