[Solved]1.28.108 API fatal error

Forum for questions and support relating to the 1.28.x releases only.
Locked
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

[Solved]1.28.108 API fatal error

Post by rockedge »

Hello, Can anyone help me in the right direction to correct a fatal error when using the ZoneMinder API?

The API works great on my 1.28.1 but starting with version 1.28.107 I began to get this

Code: Select all

Error: Trait 'CrudControllerTrait' not found
File: /opt/lampp/htdocs/zm/api/app/Controller/AppController.php
Line: 34
when I use this code or any other API interaction it fails.

Code: Select all

<head>
<style type="text/css">
div.boxes {
	display: inline-block;
	width: 200px;
	height: 100px;
	margin: 0.3em;
	border-radius: 25px;
	border: 2px solid black;
	padding: 10px;
}
</style>
</head>
<?php

  $url = "http://localhost/zm/api/events.json";
  $json_string = file_get_contents_curl($url) ;
  $parsed_json = json_decode($json_string);


		foreach ($parsed_json as $results){
$c = count($results);
$i=0;
while ($i < $c) { ;
 
    $Name = $results[$i]->Event->Name;
    $MonitorId = $results[$i]->Event->MonitorId;
    echo "<div class='boxes'>";
    echo $Name."<br>";
    echo $MonitorId."<br>";
    echo $results[$i]->Event->StartTime."<br>";
    echo $results[$i]->Event->EndTime."<br><br>";
    echo "</div>";   
	   ++$i;
	}  
    
	} 

function file_get_contents_curl($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
//Set curl to return the data instead of printing it to the browser.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);
    curl_close($ch);
     
    return $data;
    }
?>
Last edited by rockedge on Fri Nov 13, 2015 3:35 am, edited 1 time in total.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 1.28.108 API fatal error

Post by knight-of-ni »

Follow these instructions:
https://github.com/pliablepixels/zmNinj ... r-with-API

If you want a more precise answer, you need to tell us what distro you are on and how you installed zoneminder.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: 1.28.108 API fatal error

Post by rockedge »

Thank you!

OS = Puppy Linux Tahr 6.0.3 with full devx (Ubuntu binaries)
ZoneMinder 1.28.108 built from source (github zoneminder-master) on top of an XAMPP stack

Code: Select all

cmake -DZM_WEBDIR=/opt/lampp/htdocs/zm -DZM_WEB_USER=daemon -DZM_WEB_GROUP -DZM_CGIDIR=/opt/lampp/cgi-bin ./
version 1.28.1 works very well built like this.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.28.108 API fatal error

Post by asker »

Right but ZM 1.28.10x won't. A lot of changes have gone into new versions.
If you are building from source, please follow the new guides.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: 1.28.108 API fatal error

Post by rockedge »

oh...ok, so I will not be able to build anymore new versions like 1.28.10x and get the API running using this OS and cmake? Everything else works well except for the API when I have built 1.28.108 using a combination of methods that work for Puppy Linux.The entire goal is to keep zoneminder working error free on an OS that runs well on old computers.I have gotten almost everything to work very reliably. I have looked at some guides. Which ones should I be looking at?

Thanks for the help in any case.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.28.108 API fatal error

Post by asker »

Please read the link knnniggett posted above. There are cmake instructions there.
They are for Ubuntu - you can tweak them for your distro. The core build process is the same.
You need to do additional steps before cmake to get the APIs and there are specific post install instructions too. If you don't use packages you need to be aware that build from source methods may change with newer versions so it's always good to follow instructions posted along with new releases.

rockedge wrote:oh...ok, so I will not be able to build anymore new versions like 1.28.10x and get the API running using this OS and cmake? Everything else works well except for the API when I have built 1.28.108 using a combination of methods that work for Puppy Linux.The entire goal is to keep zoneminder working error free on an OS that runs well on old computers.I have gotten almost everything to work very reliably. I have looked at some guides. Which ones should I be looking at?

Thanks for the help in any case.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
bbunge
Posts: 2932
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: 1.28.108 API fatal error

Post by bbunge »

All depends on what you consider "old" equipment. I have Zoneminfer 1.28.108 on Ubuntu 15.04 running on a Dell Optiplex 760 that was shipped in May 2009. I recently upgraded from a Dell Optiplex 755 and that took everything I threw at it! If you would like I also have an old Pentium HT single core X64 machine in the shed. I can load the most recent version of Ubuntu and let you know how it runs...

Try Ubuntu. Here is the procedure for an upgrade but you can figure out how to use it for an install from the PPA master...

https://wiki.zoneminder.com/Common_Issu ... PA_version
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

SOLVED: 1.28.108 API fatal error

Post by rockedge »

SOLVED! I found that /zm/api/app/plugin/crud was empty.
So I went to https://github.com/FriendsOfCake/crud/tree/3.0
and downloaded the ZIP file. extracted to /zm/api/app/plugin/crud and BANG! it works perfectly! (that was easy!)
localhost/zm/api/host/getVersion.json gives:

Code: Select all

{
    "version": "1.28.108",
    "apiversion": "1.28.108.1"
}
Most of my machines are Dells or Gateway and an IBM thrown in (but runs everything). with 2 -4 gigs of RAM and average age is 2003-2009 as well. Use a Dell Inspiron that really does well running this setup.
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: [Solved]1.28.108 API fatal error

Post by SteveGilvarry »

FYI in knnniggetts link is the following two lines
git submodule init
git submodule update
That would have given you the crud code.

I will say I am not convinced that submodule works, case in point here, but wait until maintainers don't do it or don't get crud in source downloads from github.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: [Solved]1.28.108 API fatal error

Post by rockedge »

FYI in knnniggetts link is the following two lines
git submodule init
git submodule update
That would have given you the crud code.
Wow! your information helped immensely. I re-examined the link from knnniggetts and did the steps
git clone https://github.com/ZoneMinder/ZoneMinder.git
cd ZoneMinder/
git submodule init
git submodule update
cmake -DZM_WEBDIR=/opt/lampp/htdocs/zm -DZM_WEB_USER=daemon -DZM_WEB_GROUP=daemon -DZM_CGIDIR=/opt/lampp/cgi-bin .
make
make install

and behold...a smoothly running build of 1.28.108 on Puppy Linux Tahr 6.03. Of course after all the preparations in advance of these steps.

Thank you everyone again for your patience and advice.
Locked