dmolsen / Detector

Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices & browsers on its own without the need to pull from a central database of browser information.
http://detector.dmolsen.com/
MIT License
847 stars 80 forks source link

"Please make sure families.json.default exists" error constantly... #12

Open marcuseby opened 11 years ago

marcuseby commented 11 years ago

I'm a little weirded out by this error, as I've used your api on my local machine and it works right out of the box.

My code is basic:

require_once($path."/includes/detector/lib/Detector/Detector.php");

And thats where it fails. Always gives the same error:

Please make sure families.json.default exists before trying to have Detector build the families.json file automagically.

Locally, same setup, works perfectly and I'm checking the UA information, but on my server, no go. Constantly showing this error. So I've got a couple of thoughts, one is its on a subdomain, maybe thats affecting the pathing somehow.

I've set all directories and files to 777 just to test, but no change.

I'm really running out of thoughts and options here.

Wondering if you could help.

Thanks

Marcus

SteveBarnett commented 11 years ago

@marcuseby Are the PHP versions the same? I ran into trouble with versions because, IIRC, address 5.2 compatibility didn't quite work.

I haven't have a chance to go back and double-check it, though.

dmolsen commented 11 years ago

I'd agree with @SteveBarnett... check the PHP versions first. The other thought was permissions but you got that addressed. I know our production version of Detector is running on 5.1 and I did have issues as Steve noted. I can shoot you the ham fisted fixes I made for that.

tyssen commented 11 years ago

I'm running into the same issue. I'm running 5.3.6 locally and Detector is working fine, but on my server running 5.2.17 I'm getting the error relating to families.json.default.

dmolsen commented 11 years ago

In lib/feature-family/featureFamily.php try hardcoding the paths related to families.json.default. I think the 5.2 fix for DIR is borked when it relates to the libs like feature-family and ua-parser.

tyssen commented 11 years ago

Replacing __DIR__ with realpath(dirname(__FILE__)) seems to work OK for me.

dmolsen commented 11 years ago

Thanks for the heads up. I'll work that in in an update over the holiday.

carpusmedia commented 10 years ago

Thank you , replacing DIR with realpath(dirname(FILE)) worked for me as well.