influxdata/influxdb-client-php

Code 500 Influx CLient on VPS

GerritRie opened this issue · 6 comments

Hello guys i have a problem using the PHP_Client.
On my Xampp Local Machine (Windows 10) everthing works great. But if i put the exact same files on my Linux VPS the Server gives me a 500 Code:

Can someone maybe help me ?

Here ist my Code:

<?php

require __DIR__ . '\..\vendor\autoload.php';


use InfluxDB2\Client;
use InfluxDB2\Model\WritePrecision;
use InfluxDB2\Point;
echo getdata("Jürgen ", "M_AC_Power");
function getdata($kunde,$wert)
{
# You can generate a Token from the "Tokens Tab" in the UI
    $token = '';
    $org = 'JH';
    $bucket = 'PV-Daten';
    $client = new Client([
        "url" => "http://95.111.224.215:8086",
        "token" => $token,
    ]);


    $query = '

from(bucket: "PV-Daten")
  |> range(start: -5s)
  |> filter(fn: (r) => r["name"] == "'.$kunde.'")
  |> filter(fn: (r) => r["_field"] == "'.$wert.'")
  |> last()

  ';

    $tables = $client->createQueryApi()->query($query, $org);


    if (isset($tables[0])) {
        $data = ($tables[0]);
        $data = $data->records;
        $data = ($data[0]);

        return ($data->getValue());
    } else {
        return ("fail");
    }

}

@GerritRie, thanks for using our client. Could you please share a debug output from client? We need more info to be able to help you. You could enable debug by:

$client = new Client([
    "url" => "http://95.111.224.215:8086",
    "token" => $token,
    "debug" => true
]);

@bednar Yes i added the Debug Tag. But im not even abel to open the PHP.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Beginn of PHP:

<?php
require __DIR__ . '\..\vendor\autoload.php';
use InfluxDB2\Client;
use InfluxDB2\Model\WritePrecision;
use InfluxDB2\Point;

Internal:
Unbenannt

Website:
Unbenannt

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Try to checkout the log of InfluxDB server.

@bednar There is nothing in it i think there is something wrong with the Includements. But i cant Figure out wat i do wrong

You could try $client->health(); to check your connection and includes.

https://github.com/influxdata/influxdb-client-php/blob/master/README.md#check-the-server-status

This issue has been closed because it has not had recent activity. Please reopen if this issue is still important to you and you have additionally information.