1

I have some Firebase php code which works well on localhost but when I run it online I get server error 500 and no specific or helpful error message. Firebase say the following in the docs for the REST API:

HTTPS is required. Firebase only responds to encrypted traffic so that our data remains safe.

https://www.firebase.com/docs/rest/api/

The server has only HTTP. If I replace the Firebase code with php it works and when putting the Firebase stuff back it gives server error 500 again.

I tried on a second server which also only has HTTP and Firebase works.

Both servers are running on LAMP.

The code:

<?php

// Not working

require '../../../lib/Firebase/url.php';
getFirebase($require = true);

$firebase = new Firebase\FirebaseLib($url, $token);

$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);

$firebase->set("/test/", $test);

////////////////////////////////

// Working
header('Location: ../../../');

What's the problem?

Peter Sall
  • 47
  • 8
  • Nothing here demonstrates how the REST API call to Firebase is being made. You haven't even included a ref the third-party lib being used. Version info would also be helpful. At the root, this will turn out to be because your $url is not https, or because the third party lib has a bug. – Kato Nov 11 '15 at 20:31

1 Answers1

0

. . This error seems to be absolutely unrelated to Firebase. If you are receiving a 500 Error when accessing your PHP file, your code have some flaw. Probably you're including a wrong path or something. Just activate the error reporting in PHP (Showing all errors and warnings) and check the error message.

Community
  • 1
  • 1
diego nunes
  • 2,750
  • 1
  • 14
  • 16