Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Code 500 #160

@GerritRie

Description

@GerritRie

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");
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions