1.30.2 upgrade breaks API access

Forum for questions and support relating to the 1.30.x releases only.
blueice89
Posts: 1
Joined: Tue May 30, 2017 4:05 pm

Re: 1.30.2 upgrade breaks API access

Post by blueice89 » Tue May 30, 2017 4:29 pm

I tried the above to install apcu, but get errors.

I am trying to get my mobile app to work, it keeps saying invalid API.
API access failed, please make sure APIs configured correctly.

I tested:
zm/api/monitors.json , this works zm/api/events.json, works as well
I can get the version

a) Distro: Ubuntu 14.04
b) ZM : 1.30.4
c) I am using aws machine and to upgrade i just had some notice that said I could upgrade in my UI and said okay.

freff
Posts: 6
Joined: Sun Jul 17, 2016 3:41 am

Re: 1.30.2 upgrade breaks API access

Post by freff » Sun Jul 09, 2017 4:16 pm

Hello

I am stuck running 1.30.2 because upgrading to 1.30.4 or 1.31.x breaks my API access. I am running Ubuntu 16.04

xxxx@xxxx:/var/log/apache2$ sudo apt-get install php5-apcu
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-apcu

xxxx@xxxx:/var/log/apache2$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

From my apache.log file I get this when trying to access API's.
[Sun Jul 09 12:10:56.039929 2017] [:error] [pid 22210] [client 1.2.3.4:50252] PHP Fatal error: Call to undefined function apc_fetch() in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php on line 78

Several posts seem to indicate that php5-apcu is what is needed, but I can't figure out how to install that on Ubuntu 16.04. Can anyone help?

rockedge
Posts: 918
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: 1.30.2 upgrade breaks API access

Post by rockedge » Sun Jul 09, 2017 4:37 pm

Make sure that the php5-apcu module is activated! Simply put, check that the apcu.ini is symlinked from /etc/php5/mods-available/apcu.ini to /etc/php5/cgi/conf.d/apcu.ini

you can use a2enmod to do this.
important: restart the Apache server!

then in a browser test the API by logging into ZM and then using the URL -> http://your_zm_server_ip/zm/api/host/getVersion.json
you should see something like this ->

Code: Select all

{"version":"1.31.1","apiversion":"1.0"}
I hope this helps.

freff
Posts: 6
Joined: Sun Jul 17, 2016 3:41 am

Re: 1.30.2 upgrade breaks API access

Post by freff » Sun Jul 09, 2017 6:06 pm

Hi thanks for the advice but unfortunately it appears that I do not have php5-apcu installed. It seems that it is not possible to install that package on Ubuntu 16.04?

rockedge
Posts: 918
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: 1.30.2 upgrade breaks API access

Post by rockedge » Sun Jul 09, 2017 6:16 pm

PHP 7 ships with a built-in opcode cacher for caching and optimizing PHP intermediate code, it has the name 'opcache' and is available in the package php7.0-opcache. It is strongly recommended to have an Opcache installed to speed up your PHP page. Besides opcache, I will install APCu which is a compatibility wrapper for opcache to provide the functions of the APC cache, an often used caching system in php 5.x versions and many CMS systems still use it.
https://www.howtoforge.com/tutorial/ins ... 6-04-lamp/
what version of PHP is running on your system?

I think you can open a terminal and use for PHP 7 ->

Code: Select all

apt-get -y install php7.0-opcache php-apcu
and then enable the module and restart Apache.

Code: Select all

systemctl restart apache2

freff
Posts: 6
Joined: Sun Jul 17, 2016 3:41 am

Re: 1.30.2 upgrade breaks API access

Post by freff » Sun Jul 09, 2017 7:33 pm

thanks for the link. It took multiple steps. I'm not sure what I did, but everything seems to be working now. In case others find this problem, the steps to resolve were something like this.

sudo apt-get -f install
apt-get -y install php7.0-opcache php-apcu
apt-get -y install php7.0 libapache2-mod-php7.0 -f
had to edit some timezone settings in a php.ini config file
sudo apt install libapache2-mod-php
sudo a2dismod php5
sudo a2enmod php7.0
sudo service apache2 restart

thanks again, Rockedge!

rockedge
Posts: 918
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: 1.30.2 upgrade breaks API access

Post by rockedge » Mon Jul 10, 2017 1:55 am

:D

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests