Page 1 of 1

(SOLVED, I think) Working ZMNinja on Raspbian and Zoneminder 1.28.1-8

Posted: Sat Jan 16, 2016 12:54 am
by gundark2
So having a problem.
I followed all instruction that I could find to setup zoneminder 1.28.1 on my raspberry pi 2 B. Everything works. So trying to install api so that I can use zmninja. I followed the instructions, got a red band when I did http://localhost/zm/api, I followed the steps on the link for fixing that problem.
Now I type http://localhost/zm/api and I get:
The requested URL /usr/share/zoneminder/www/api/app/webroot/ was not found on this server.
I know I have just done something silly to mess this up, webroot is in the app directory, the permissions are correct, can someone point me in the right direction?
Also zmninja says login-validated but api failed, fyi.

api problems

Posted: Sat Jan 16, 2016 1:41 am
by gundark2
Could anyone point me to where cake would publish any errors, i mean I have no idea whats generating this error and if more detail exists somewhere else?

Re: api problems

Posted: Sat Jan 16, 2016 2:48 am
by SteveGilvarry
1.28.1 did not have the API, most people using zmninja have been using a master snapshot aka development version 1.28.99 and up. Upcoming 1.29.0 release is first one to have the API included in a release.
Pretty sure zmninja is using a hacked logon on the standard GUI to get a session hence why you get the logon working.

Re: api problems

Posted: Sat Jan 16, 2016 8:32 am
by asker
Yep, you need ZM 1.28.109 or 1.29. I know its possible to post-install the APIs into 1.28, but its too much hassle.

Since the APIs don't (yet) have a concept of a login, zmNinja logs into ZM (which does not need APIs, and therefore succeeds) and then uses that session information to access APIs (where it fails)

Re: api problems

Posted: Sat Jan 16, 2016 5:13 pm
by gundark2
Thank you both for responding,
So in your experience do I need to wait until my distro has a package with a version with API support? I am pretty decent at the command line and can follow direction, though I have not ever successfully compiled anything from source. Been googling for a bit and am going to continue, just looking for advice.


Much closer!

Posted: Sat Jan 16, 2016 7:02 pm
by gundark2
Ok, so I think I have made some good progress.
I used this page to enable testing and unstable repositories: ... om-testing

Then I installed the unstable version of zoneminder 1.28.1-8:
sudo aptitude install cakephp/testing
sudo aptitude install libstdc++6/testing
sudo aptitude install zoneminder/unstable

Then enabled the zoneminder conf in apache2
sudo a2enconf zoneminder

I then followed the instructions on this page with a change, it would fail as I guess the new version on the server is 1.28.2 so anywhere it said 1.28 i made it 1.28.2 and that worked. I also paid close attention to make sure sense my file structure is a little different than these instructions that I got it right for raspbian ... -1-28-api/

Now when i go to the browser "http://serverip/zm/api" I get the CakePHP screen, the first 4 bars are green and I have two yellows;

CakePHP is NOT able to connect to the database.
Database connection "Mysql" is missing, or could not be created.


DebugKit is not installed. It will help you inspect and debug different aspects of your application.
You can install it from GitHub

Man I feel like I am so close I can taste it, cake, will update you all if I get this going!!


More progress

Posted: Sat Jan 16, 2016 8:36 pm
by gundark2
Hopefully this ends up working, still doesn't but hopefully it bugs no one that im trying.
So, I got cake to connect to the mysql database, again following the above directions and then:
cd /usr/src/zoneminder-1.28.2/web/api/app/Config
sudo nano database.php

Then go down to:

public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'zmuser', * Make sure it looks like this!!!
'password' => 'zmpass', * Make sure it looks like this!!!
'database' => 'zm', * Make sure it looks like this!!!
'prefix' => '',
//'encoding' => 'utf8',

public $test = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
//'encoding' => 'utf8',

Now green bars, just still no zmninja love. :(



Posted: Sat Jan 16, 2016 9:16 pm
by gundark2
ZmNinja is working!!!!!

so, after all of the above:
cd /usr/src/zoneminder-1.28.2/web/api/app/Controller
sudo nano HostController.php

Now paste in the contents of the file from the internet: ... roller.php

Same thing but with Statescontroller.php

And now things seem to be working for me, I can look at monitors, see live cam feeds.

Please let me know if any of this is useful to anyone, I suppose I could clean it up and make a howto if anyone was interested.

Re: (SOLVED, I think) Working ZMNinja on Raspbian and Zoneminder 1.28.1-8

Posted: Sun Jan 17, 2016 1:46 pm
by asker
Are you the same person who sent me zmNinja logs? I guess its all solved now?

Re: (SOLVED, I think) Working ZMNinja on Raspbian and Zoneminder 1.28.1-8

Posted: Sun Jan 17, 2016 7:10 pm
by gundark2
Think so,
Sorry again about that.
But thanks to your help I've made a huge ton of progress. I have gotten it down to the point where I have almost no errors poping up, and now I am just setting up and getting the certs all done. I have never got this involved with this stuff before but things just keep going well for me. I am going to try and commit to making a how to, as I think I owe it to the community for all your help.

Re: (SOLVED, I think) Working ZMNinja on Raspbian and Zoneminder 1.28.1-8

Posted: Thu Feb 25, 2016 8:19 pm
by maco1717
Hi gundark2,

I was wondering if you could give me a hand setting this up.

tried following your steps but I'm not sure.

more specifically what did you do exactly to get testing and unstable versions? tried using the link you posted but was unsure of which reply from the post to use...

for what I can see the rest of instruction are quite clear I think at the moment xD

I would be very grateful if anyone could give me any guidance on how to get this working.