0
I’m having a problem making a connection to Oracle in PHP 7 appears the error message below:
ERROR: could not find driverERROR: could not find driver
Notice: Undefined variable: conAD in C:\laragon\www\systemag\area_restritaAG.php on line 59
Fatal error: Uncaught Error: Call to a member function query() on null
in C:\laragon\www\systemag\area_restritaAG.php:59 Stack trace:
#0 {main} thrown in C:\laragon\www\systemag\area_restritaAG.php on line 59
Follow the codes I tried to make below:
try {
$conAG = new PDO('oci:dbname=//localhost:1521/xe/ORCL', 'core_11_1', 'T3cn1c05p');
$conAG->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
try {
$conAD = new PDO('oci:dbname=//localhost:1521/xe/ORCL', 'wms_eadi', 'wms_eadi');
$conAD->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
//$db_connectAG = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.220.43)(PORT=1521)) (CONNECT_DATA=(SID=alcisagprd)))';
//$db_userAG = 'core_11_1';
//$db_passAG = 'T3cn1c05p';
//$db = "oci:dbname=alcisagprd";
//$conAG = oci_connect($db_user,$db_pass,$db_connectAG,'AL32UTF8');
//$conAG = new PDO("oci:dbname=".$db_connectAG,$db_userAG,$db_passAG);
//$db_connectAD = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.220.32)(PORT=1522)) (CONNECT_DATA=(SID=ALCISSTB)))';
//$db_userAD = 'wms_eadi';
//$db_passAD = 'wms_eadi';
//$conAD = oci_pconnect($db_userAD,$db_passAD,$db_connectAD,'AL32UTF8');
//$conAD = oci_connect("wms_eadi","wms_eadi","ALCIS_NEW"); conexão alternativa
//$conAG = oci_connect('core_11_1', 'T3cn1c05p', 'ALCISAGPRD','AL32UTF8');
//$AD = oci_parse($conAD,"select k.suchbegriff from KLIENTEN k where (k.suchbegriff = '".$cnpj."' or k.suchbegriff = '".$tb_cnpj."')");
//oci_execute($AD);
//$lineAD = oci_fetch_all($AD, $res);
$AD = $conAD->query("select k.suchbegriff from KLIENTEN k where (k.suchbegriff = '".$cnpj."' or k.suchbegriff = '".$tb_cnpj."')");
$AD->execute();
$lineAD = $AD->rowCount();
$AG = $conAG->query("select k.suchbegriff from KLIENTEN k where (k.suchbegriff = '".$cnpj."' or k.suchbegriff = '".$tb_cnpj."')");
$AG->execute();
$lineAG = $AD->rowCount();
//$AG = oci_parse($conAG,"select k.suchbegriff from KLIENTEN k where (k.suchbegriff = '".$cnpj."' or k.suchbegriff = '".$tb_cnpj."')");
//oci_execute($AG);
//$lineAG = oci_fetch_all($AG, $res);
if($lineAD > 0 && $lineAG > 0){
header("Location: clientes/indexFull.php");
}else if($lineAD > 0 && $lineAG == 0){
header("Location: clientes/index.php");
}else if($lineAG > 0 && $lineAD == 0){
header("Location: clienteAG/indexAG.php");
}else{
echo "<script>
alert('CNPJ NÃO SE ENCONTRADO NA BASE DADOS\\nFAVOR ENTRAR EM CONTATO COM ATENDIMENTO');
location.href='formulario_cadastroTeste.php';
</script>";
}
I’m using the Laragon and have already enabled the extensions oci8_12c, oci8_11g and idle these last two I downloaded in the of this link
I already checked the php.ini and lines with such extensions are uncommented.
I’ve already left the Laragon with the services I’ve restarted the server, still can’t make the connection anyone can help me?
Windows or Linux? Restarted the server? Instant Client is installed? Why did you fail to
conAD
andconAG
nay?– Augusto Vasques
is a Windows Server 2016 yes restarted, I did not install the Instant Client I will install here.
– teste
I installed the Instant Client and about the error is giving us both that I sent only one error message not the other. but even installing did not work
– teste
I know it’s not your goal to attempt a connection via ODBC. Just to rule out the possibility of the problem being with the data source.
– Augusto Vasques