Art-of-WiFi / UniFi-API-browser

Tool to browse data exposed by Ubiquiti's UniFi Controller API
MIT License
1.1k stars 150 forks source link

fetch_collection.php returning 500 #76

Closed rnehring closed 4 years ago

rnehring commented 4 years ago

I've managed to install the browser, and it's connecting to my controller, but when I try to pull any stats I'm getting a 500 error from the fetch_collection.php in the Javascript console. Any ideas?

malle-pietje commented 4 years ago

Hmm, is that only when fetching stats, but does the sites list get populated in the correct manner? Which controller version is this on?

rnehring commented 4 years ago

It does populate the name of the site correctly, and it's when I try to do anything from the collections drop down... controller version 5.11.50

malle-pietje commented 4 years ago

One thing you can do is to enable debug mode in the config file. This will generate debug info in the webserver error logs and in the browser console.

malle-pietje commented 4 years ago

Version shouldn't be the issue, tested with that and also works with 5.12.22.

malle-pietje commented 4 years ago

Have a close look at the webserver error log as well. There should be hints there.

rnehring commented 4 years ago

This is the debug errror I'm getting:

[Wed Nov 13 11:37:21 2019] [error] [client 10.10.0.8] PHP Parse error: syntax error, unexpected '.', expecting ')' in /var/www/unifi/ajax/fetch_collection.php on line 141, referer: http://10.10.0.3/unifi/

rnehring commented 4 years ago

I may have figured it out.... looks like my PHP is only 5.4, not 5.6...

malle-pietje commented 4 years ago

Are you using a PHP version lower than 5.6?

malle-pietje commented 4 years ago

That line uses a feature in PHP that is supported from 5.6 onwards: https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list.new

rnehring commented 4 years ago

Any chance there's a way to polyfill, or do I just need to upgrade?

malle-pietje commented 4 years ago

Apparently we just missed each other;-)

malle-pietje commented 4 years ago

Wouldn't know... I suggest you upgrade, 5.4 is roughly 6 years old.

rnehring commented 4 years ago

Yea, that'd probably be best. Just don't have access to do it right now. Thanks for all your hard work and effort on this!