php-tracks-recorder icon indicating copy to clipboard operation
php-tracks-recorder copied to clipboard

Owntracks app reports 'error HTTP Response 500'

Open MastaBaba opened this issue 2 years ago • 5 comments

I've set up php-tracks-recorder on my server. When visiting /record.php, I get this:

[{"_type":"cmd","action":"action","content":"No data to read"}]

In the Owntracks app (on iOS), I have setup 'Authentication' to 'off', and have the app point to /record.php on my server. The status as reported by the app is this:

error HTTP Response 500 The operation couldn't be completed (HTTP Response error 500) {}

If I switch to Overland, I do not get presented with any error messages, but, in Overland, the 'Last sent' does not change from 'n/a', and no data appears to come in to the recorder.

How to fix this?

MastaBaba avatar Jul 12 '21 15:07 MastaBaba

Check your web server logfile for the actual error message. It might be a problem writing to the database.

mbirth avatar Jul 12 '21 18:07 mbirth

Indeed. My host did a switcheroo on the SQL server. Thanks for the suggestion!

I would have thought the client, at /php-tracks-recorder/ would also report a database error, though.

MastaBaba avatar Jul 12 '21 23:07 MastaBaba

Actually, not quite. The problem may have been an incorrectly configured .htaccess file. (Thanks to my hosting provider.)

Now, using Owntracks, php-tracks-recorder recorded one point, but after that, Owntracks is back to giving me 500 errors. My error log is empty. But my access log reports the failed access:

{{server}} 0 {{IP}} - - [13/Jul/2021:01:15:22 +0200] "POST /php-tracks-recorder/record.php HTTP/2.0" 500 67 "-" "OwnTracks/14.2.2 CFNetwork/1240.0.4 Darwin/20.5.0”

The php-tracks-recorder log contains this, a lot:

2021-07-13 01:40:43 - 172.68.24.114 - Insert KO - Can't write to database : Duplicate location found for epoch. Ignoring.

After one successful write:

2021-07-13 01:18:38 - 172.68.24.250 - Insert OK

If I change my tracker_id in Owntracks, I see exactly one write in the database, even if I go for a walk.

(Overland now successfully pushes multiple locations to php-tracks-recorder. I can see the database fill up, but with no tracker_id.)

MastaBaba avatar Jul 13 '21 00:07 MastaBaba

I also see the same problem, e.g. error HTTP Respüose 500 in OwnTracks, but the web interface of php-tracks-recorder loads just fine, albeit empty.

habi avatar Sep 20 '21 08:09 habi

Hi.

I got the same problem and here is the (anonimized) log:

[proxy_fcgi:error] [pid 25273] [client xxxxxx:d8d:f7d7:34052] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getFriends() on null in /var/customers/webs/xxx.de/ot/lib/recorder/OwntracksRecorder.php:114\nStack trace:\n#0 /var/customers/webs/xxx.de/ot/record.php(82): OwntracksRecorder->getFriendsLocation(Object(OwntracksRecordStructure))\n#1 {main}\n thrown in /var/customers/webs/xxx.de/ot/lib/recorder/OwntracksRecorder.php on line 114'

I just commented out Line 114 in record.php for now and since then it worked...😂

schnudeldudel avatar Oct 31 '21 15:10 schnudeldudel