Fatal error: Uncaught Error: Call to undefined function oci_connect () in C

0

Greetings!

I was working with PHP Version 5.4.3 connected 2 Databases (Oracle Database version 10g Enterprise Edition Release 10.2.0.5.0 - 64bit) (version Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit) When I upgrade to PHP Version 7.2.1 I get the following error:

  

Fatal error: Uncaught Error: Call to undefined function oci_connect () in C: \ xampp \ htdocs \ test \ connection \ class_conexion.php: 33 Stack trace: # 0 C: \ xampp \ htdocs \ test \ connection \ class_conexion .php (28): Connection d-> connect () # 1 C: \ xampp \ htdocs \ test \ connection \ test.php (8): Connection d-> construct () # 2 {main} thrown in C: \ xampp \ htdocs \ test \ connection \ class_conexion.php on line 33

here is the class_conexion.php file

<?php 
class Conexionbd
{   
private $_conexion;
private $_resultado;
private $_servidor;
private $_basedatos;
private $_usuario;
private $_clave;
private $_query;

//funcion asigna variables de config a variables privadas
public function __construct(){
  include("config.php");
  $this->_servidor = $config['servidor'];
  $this->_basedatos = $config['basedatos'];
  $this->_usuario = $config['usuario'];
  $this->_clave = $config['clave'];
  $this->conectar();
 }

//Metoodo con el que me conecto
private function conectar(){
  $this->_conexion  = 
  ($this->_usuario, $this->_clave, $this->_servidor, 'UTF8') or
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
  }

//metodo para OCI_PARSE
public function ociParse($query){
 $this->_query = $query;
 $this->_resultado = oci_parse($this->_conexion, $this->_query);
 }

 //EJECUTA EL QUERY 
 public function execute($perror){
 //$this->execute = $execute;
 //$this->_resultado = oci_parse($this->_conexion, $this->_query);
 return oci_execute($this->_resultado) or die(oci_error($this->_conexion)." ( ".$perror." )");
 }

//metodo para buscar.
public function assoc(){
  return oci_fetch_array($this->_resultado, OCI_ASSOC+OCI_RETURN_NULLS);
}

public function assocAll(){
  oci_fetch_all($this->_resultado, $res);
  return $res;
}

public function rows(){
  return oci_num_rows($this->_resultado);
}

public function close(){
  return oci_close($this->_conexion);
}
}
?>

I appreciate all the help you can give me on the subject.

Greetings!

    
asked by Jefferson 22.01.2018 в 22:26
source

1 answer

0

Solution:

  • Whenever you connect Oracle Database, try using 32-bit client libraries, since XAMP PHP is compiled with 32 bits (even if you have 64 bits in the S.O)
  • Download Oracle Client from the Oracle page; you can search in google "Instant Client Downloads for Microsoft Windows (32-bit)"
  • Paste it in C: \ instantclient_12_2 and in C: / xamp / php
  • Set the path to the top (C: \ instantclient_12_2) in System Environment Variable (PATH).
  • Then go to C: \ xampp \ php \ php.ini and uncomment the extension = php_oci8_12c.dll
  • Restart the XAMP
  • Greetings!

        
    answered by 29.01.2018 в 16:43