E
E
Egor Ivan.2020-08-26 12:04:05
PHP
Egor Ivan., 2020-08-26 12:04:05

What could be the problem with querying Oracle database on wordpress (status 500)?

Good day!
I ask for help with solving the problem:
At the moment, to plot graphs, a request from the executable php file goes to the Oracle database, ajax receives the ready request data and builds the canvasjs graph itself based on them, which I refer to from wordpress via iframe.
How to implement this on a server with the wordpress engine? I throw the file with the php code into /wp-includes/, when I go to the file (testwpd.php) nothing happens (status 500), but I expect to receive data in json format.
.htaccess checked.
I am attaching the testwpd.php code:

<?php

$dataPoints = array();
$db ="(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = port)))(CONNECT_DATA = (SERVICE_NAME = data)))";
$conn = oci_connect('name', 'pass', $db, 'AL32UTF8', OCI_SYSDBA);
$query = "select ...";
$query2 = "select ...";
$stid = oci_parse($conn, $query);
oci_execute($stid);
$stid2 = oci_parse($conn, $query2);
oci_execute($stid2);
$res="[";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS))
        {
  $row2 = oci_fetch_array($stid2, OCI_ASSOC+OCI_RETURN_NULLS);
  $res .= '{"h":'.'"'.$row['YR'].'"'.', "value":'. $row['CNT'].', "h2":'.'"'.$row2['YR'].'", "value2":'.$row2['CNT'].'},';
        }
        oci_free_statement($stid);
  oci_free_statement($stid2);
        oci_close($conn);
echo substr($res,0,-1).']';
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-08-26
@FanatPHP

In anything.
In the event of a 500 error, you should not go to the forum to fortune-tellers, but look at the web server logs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question