Can't access API on 1.30.4 and Debian 9

Forum for questions and support relating to the 1.30.x releases only.
Locked
User avatar
JustinG
Posts: 6
Joined: Thu Jun 01, 2017 3:34 am

Can't access API on 1.30.4 and Debian 9

Post by JustinG »

Hello All,

My system has been running great for the past year. Recently I upgraded the system from Debian 8 to Debian 9. Everything seems to work fine except the API access. When accessed from a browser, I get an HTTP Error 500.

In my apache error.log, I see the following:

Code: Select all

[Mon Jan 29 11:04:32.716667 2018] [:error] [pid 16050] [client 100.x.x.x:39302] PHP Fatal error:  Call to undefined function apc_fetch() in /usr/share/php/Cake/Cache/Engine/ApcEngine.php on line 91
After I've researched the other forum posts with the same issue (viewtopic.php?f=36&t=26140 and [url]viewtopic.php?f=36&t=26122[/url)], and they stated to install php-apcu-bc and cakephp. Tried to install them but my system says they're already installed:

Code: Select all

cakephp is already the newest version (2.8.5-1).
php-apcu-bc is already the newest version (1.0.3-2).
I even tried re-installing the zoneminder package, as well as the cakephp and php-apcu-bc package, but no luck.

Some more info for troubleshooting:
PHP Version: PHP 7.0.27-0+deb9u1 (cli) (built: Jan 5 2018 13:51:52) ( NTS )
Apache2 Verison: 2.4.25
ZM Version: 1.30.4
OS: Debian 9 Stretch

Any help would be greatly appreciated.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can't access API on 1.30.4 and Debian 9

Post by bbunge »

Change permissions in /usr/share/zoneminder/

chown -R www-data:www-data /usr/share/zoneminder/
User avatar
JustinG
Posts: 6
Joined: Thu Jun 01, 2017 3:34 am

Re: Can't access API on 1.30.4 and Debian 9

Post by JustinG »

Hello bbunge,

Thank you for the suggestion. I checked permissions and www-data was already chown-ed to that folder.

I re-ran the command anyway, but I still get an HTTP Error 500 when trying to access anything related to the API.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can't access API on 1.30.4 and Debian 9

Post by bbunge »

You may want to force a reinstall of Zoneminder 1.30.4 and include vlc-plugin-base php7.0-gd.

See: https://wiki.zoneminder.com/Debian_9_64 ... e_Easy_Way
mic07
Posts: 7
Joined: Tue Feb 06, 2018 9:10 pm

Re: Can't access API on 1.30.4 and Debian 9

Post by mic07 »

Hi Justin!

I'm not sure how the package names under debian are, but since you are using php7.0, did you check if there is a package for php7.0? like php7.0-apcu and php7.0-apcu-bc
what's the output of

Code: Select all

apt-cache search 'php.*apcu.*'
BR Michael
User avatar
JustinG
Posts: 6
Joined: Thu Jun 01, 2017 3:34 am

Re: Can't access API on 1.30.4 and Debian 9

Post by JustinG »

Thank you all so much for your posts, I do appreciate it.

I should note that I was able to replicate this in another one of my systems. It seems the issue occurs after upgrading a Debian Jessie (8) box to Debian Stretch (9).

I've tried re-installing the zoneminder package, but no avail. I tried the following command:

Code: Select all

apt install --reinstall zoneminder
Should I try the reinstall a different way?

Also the output of the apt-cache search command is:

Code: Select all

php-apcu - APC User Cache for PHP
php-apcu-bc - APCu Backwards Compatibility Module
php-symfony-polyfill-apcu - Symfony polyfill backporting apcu_* functions to lower PHP versions
I ran a apt install for all the php-apc packages there, but they're already installed.

Code: Select all

php-apcu is already the newest version (5.1.8+4.0.11-1).
php-apcu-bc is already the newest version (1.0.3-2).
I have deployed about 5 ZoneMinder boxes to my friends and family all seeing the same issue when updated from Debian 8 to Debian 9. (All boxes configured the same way at the beginning).
Thanks again for your time.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Can't access API on 1.30.4 and Debian 9

Post by rockedge »

are all the directories that need to be in place correct? such as

Code: Select all

/usr/share/zoneminder/www/api/app/tmp/cache
and can it e written to by www-data?
make sure

Code: Select all

/usr/share/zoneminder/www/api/app/tmp/cache/models
and

Code: Select all

/usr/share/zoneminder/www/api/app/tmp/cache/persistent
exist and are writable by www-data
User avatar
JustinG
Posts: 6
Joined: Thu Jun 01, 2017 3:34 am

Re: Can't access API on 1.30.4 and Debian 9

Post by JustinG »

Thank you so much for the suggestion.

I confirmed those directories do exist. www-data has full read+write permission to them.

I still however get an error 500.

Image

And in Apache's error.log:

Code: Select all

[Sun Feb 11 23:45:08.713776 2018] [:error] [pid 12126] [client 100.x.x.x:56877] PHP Fatal error:  Call to undefined function apc_fetch() in /usr/share/php/Cake/Cache/Engine/ApcEngine.php on line 91
This is such a strange issue. I double checked on my other box having issues as well and same thing, the directories exist and www-data has full permission to them, but I still get an error 500.

Am I going to have to completely re-install these boxes? :(
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Can't access API on 1.30.4 and Debian 9

Post by rockedge »

I have a DebianDog (Debian 9 Stretch based) set up running with ZM 1.30.4 at my fingertips at the moment...I used the Debian zm install notes and the system is up and running and ZM shows a green Log indicator......so far the http://zm-server/zm/api/host/getVersion.json is returning the correct response...but I do remember not being able to get zmNinja to run with the Debian setup. While I have this going I will test out some stuff and see if we can get to the bottom of this....I recall having some strange nagging little problems in the Debian 9 setup that do not appear in the Ubuntu setup.
User avatar
JustinG
Posts: 6
Joined: Thu Jun 01, 2017 3:34 am

Re: Can't access API on 1.30.4 and Debian 9

Post by JustinG »

Interesting.

I can confirm when a clean install is performed on Debian 9 it works fine. I've only had this issue with boxes upgraded from Debian 8 to Debian 9. Out of 3 boxes I've upgraded, all 3 were effected.

What a strange issue. Oh well, I'll re-install them with a clean Debian 9 sometime later this week.
mic07
Posts: 7
Joined: Tue Feb 06, 2018 9:10 pm

Re: Can't access API on 1.30.4 and Debian 9

Post by mic07 »

Maybe this thread can help (I had similar problems with Debian 9 on Tinkerboard):
ZM 1.30.4 API issue on ubuntu 17.10
Locked