API not working. Missing files?

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
francis3
Posts: 9
Joined: Wed Jan 16, 2019 8:30 am

API not working. Missing files?

Post by francis3 » Wed May 15, 2019 9:22 am

Hi all,

I've recently upgraded my zoneminder installation from
Debian stretch stable with zoneminder 1.30.4
to
Debian buster testing with zoneminder 1.32.3.
Zoneminder packages from deb-multimedia repository.


Quite impressed with the new stability and smoothness of the setup.
Solved my "blue screen" issue described here
viewtopic.php?f=36&t=28082&hilit=blue+screen

Thanks to all the developers!


So far only one issue: can't get APi working as in the previous setup.

I've read again the docs here:
https://zoneminder.readthedocs.io/en/stable/api.html

Searched the forum and think I have the same issue described here:
viewtopic.php?f=38&t=27861&p=108685&hilit=api#p108685


I'm missing "host" dir in /usr/share/zoneminder/www/api/

Tried the suggested fix:

Code: Select all

<Directory "/usr/share/zoneminder/www/api/app">
   RewriteEngine on
   RewriteRule ^$ webroot/ [L]
   RewriteRule (.*) webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app/webroot">
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteBase /zm/api
</Directory>

in
/etc/apache2/conf-enabled/zoneminder.conf

and restarted apache2, but still no go.


Any suggestion?

Thx in advance,
francis3

francis3
Posts: 9
Joined: Wed Jan 16, 2019 8:30 am

Re: API not working. Missing files?

Post by francis3 » Thu May 16, 2019 12:58 pm

Just for the record, if someone else is going trough the same issue.

On a test system

Code: Select all

apt-show-versions | grep -v buster
there were some leftovers from previous debian php packages

Code: Select all

cpp-6:i386 6.3.0-18+deb9u1 installed: No available version in archive
gcc-6:i386 6.3.0-18+deb9u1 installed: No available version in archive
gcc-6-base:i386 6.3.0-18+deb9u1 installed: No available version in archive
libapache2-mod-php7.0:i386 7.0.33-0+deb9u3 installed: No available version in archive
libasan3:i386 6.3.0-18+deb9u1 installed: No available version in archive
libgcc-6-dev:i386 6.3.0-18+deb9u1 installed: No available version in archive
libisl15:i386 0.18-1 installed: No available version in archive
libmpfr4:i386 3.1.5-1 installed: No available version in archive
linux-compiler-gcc-6-x86:i386 4.9.168-1 installed: No available version in archive
linux-headers-4.9.0-8-686:i386 4.9.144-3.1 installed: No available version in archive
linux-headers-4.9.0-8-common:all 4.9.144-3.1 installed: No available version in archive
linux-image-4.9.0-9-686:i386 4.9.168-1 installed: No available version in archive
linux-kbuild-4.9:i386 4.9.168-1 installed: No available version in archive
perl-modules-5.24:all 5.24.1-3+deb9u5 installed: No available version in archive
php-mcrypt:all 1:7.0+49 installed: No available version in archive
php7.0:all 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-cgi:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-cli:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-common:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-gd:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-json:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-mbstring:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-mcrypt:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-mysql:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-opcache:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-readline:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-xml:i386 7.0.33-0+deb9u3 installed: No available version in archive
php7.0-zip:i386 7.0.33-0+deb9u3 installed: No available version in archive
ssmtp:i386 2.64-8+b2 installed: No available version in archive

purged all those packages

Purged also:
apache2
php
zoneminder
mariadb

started almost with a fresh system :-)

Reinstalled zoneminder following:
https://wiki.zoneminder.com/Debian_9_64 ... e_Easy_Way

Had to manually install the DB.

Code: Select all

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
--
Missed the icons from web interface
Solved following:
viewtopic.php?f=38&t=27514&p=107916&hilit=icons#p107916
---

The link http://myip/zm/api/ now was working, but there was a warning about
"NOT writable Your tmp directory"

Solved following:
viewtopic.php?f=36&t=26200&p=100710&hil ... ot#p100710
and
viewtopic.php?f=38&t=27651&p=107695&hil ... mp#p107695

was missing /usr/share/zoneminder/www/api/app/tmp

Now i get the correct output from
http://myip/zm/api/host/getVersion.json

Code: Select all

{
    "version": "1.32.3",
    "apiversion": "1.0"
}
Also had to get a zoneminder.conf for apache2 from a ubuntu install via iconnor's ppa for 1.32

Code: Select all

# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>

# Order matters. This alias must come first.
Alias /zm/cache /var/cache/zoneminder/cache
<Directory /var/cache/zoneminder/cache>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
  Options -Indexes +FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>

# For better visibility, the following directives have been migrated from the
# default .htaccess files included with the CakePHP project.
# Parameters not set here are inherited from the parent directive above.
<Directory "/usr/share/zoneminder/www/api">
   RewriteEngine on
   RewriteRule ^$ app/webroot/ [L]
   RewriteRule (.*) app/webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app">
   RewriteEngine on
   RewriteRule ^$ webroot/ [L]
   RewriteRule (.*) webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app/webroot">
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteBase /zm/api
</Directory>



Now everything seems fine :-D


Regards,
francis3
Last edited by francis3 on Tue May 21, 2019 6:52 am, edited 1 time in total.

SkippyDo
Posts: 97
Joined: Mon Nov 20, 2017 6:49 pm

Re: API not working. Missing files?

Post by SkippyDo » Thu May 16, 2019 8:09 pm

Please report back on how this combo is working for you. I tried it and ended up with database corruptions and couldn't get it to be stable under Debian "Buster."

francis3
Posts: 9
Joined: Wed Jan 16, 2019 8:30 am

Re: API not working. Missing files?

Post by francis3 » Fri May 17, 2019 8:37 am

Sure I'll do.
I've read your thread about running zm under debian/buster.

My "old" buster system was running from a couple of weeks now.
I've just moved to production the new cloned system with the described fix.

No issue so far, and API working. :-)

Just noticed the lack of package ssmtp in testing. Gonna try to use the old package
from stable.

Regards,
francis3

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest