dimanche 23 août 2020

error in database connection in php with firebase

I have got a php script for connect php to firebase realtime database.I can run the script successfully from the command line, but when I try it from a web browser(on my host), it doesn't work. `

<?php
require __DIR__.'/vendor/autoload.php';

use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;

$serviceAccount =  ServiceAccount::fromJsonFile(__DIR__.'/blocktask-b86a0-firebase-adminsdk-h6093-19e2b6f222.json')
$firebase = (new Factory)
    ->withServiceAccount($serviceAccount)
    ->withDatabaseUri('https://blocktask-b86a0.firebaseio.com')
    ->create();
    
$databasse = $firebase -> getDatabase();

?>

enter image description here




Aucun commentaire:

Enregistrer un commentaire