ZoneMinder 1.32.3 Freenas API Failure

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
everettcomstock
Posts: 3
Joined: Thu Mar 28, 2019 10:11 pm

ZoneMinder 1.32.3 Freenas API Failure

Post by everettcomstock » Thu Mar 28, 2019 10:28 pm

Hi,

I recently installed ZoneMinder using the FreeNAS-11.2-U2.1 plugin. Pretty much everything is working fine except for the ZoneMinder API. When I attempt to load the /zm/api/host/getVersion.json page as instructed in the API Validation instructions, I receive the following error:

Code: Select all

Warning (2): mkdir(): Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): mkdir() [<a href='http://php.net/function.mkdir'>function.mkdir</a>]: Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): mkdir() [<a href='http://php.net/function.mkdir'>function.mkdir</a>]: Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): ini_set() [<a href='http://php.net/function.ini-set'>function.ini-set</a>]: Headers already sent. You cannot change the session module's ini settings at this time [CORE/Cake/Model/Datasource/CakeSession.php, line 581]
Warning (2): mkdir() [<a href='http://php.net/function.mkdir'>function.mkdir</a>]: Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): mkdir() [<a href='http://php.net/function.mkdir'>function.mkdir</a>]: Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): file_put_contents(/var/log/zm/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory [CORE/Cake/Log/Engine/FileLog.php, line 142]
Warning (2): mkdir() [<a href='http://php.net/function.mkdir'>function.mkdir</a>]: Permission denied [CORE/Cake/Log/Engine/FileLog.php, line 106]
Warning (2): file_put_contents(/var/log/zm/error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory [CORE/Cake/Log/Engine/FileLog.php, line 142]
Warning (2): ini_set() [<a href='http://php.net/function.ini-set'>function.ini-set</a>]: Headers already sent. You cannot change the session module's ini settings at this time [CORE/Cake/Model/Datasource/CakeSession.php, line 581]{ "success": false, "data": { "code": 500, "name": "Unable to configure the session, setting session.use_trans_sid failed.", "message": "Unable to configure the session, setting session.use_trans_sid failed.", "url": "\/zm\/api\/host\/getVersion.json?p=%2Fhost%2FgetVersion.json", "exception": { "class": "CakeSessionException", "code": 500, "message": "Unable to configure the session, setting session.use_trans_sid failed.", "trace": [ "#0 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Model\/Datasource\/CakeSession.php(619): CakeSession::_configureSession()", "#1 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Model\/Datasource\/CakeSession.php(632): CakeSession::_cookieName()", "#2 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Model\/Datasource\/CakeSession.php(404): CakeSession::_hasSession()", "#3 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Controller\/Component\/SessionComponent.php(69): CakeSession::read('user')", "#4 \/usr\/local\/www\/zoneminder\/api\/app\/Controller\/AppController.php(70): SessionComponent->read('user')", "#5 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Event\/CakeEventManager.php(243): AppController->beforeFilter(Object(CakeEvent))", "#6 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Controller\/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))", "#7 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Routing\/Dispatcher.php(189): Controller->startupProcess()", "#8 \/usr\/local\/www\/zoneminder\/api\/lib\/Cake\/Routing\/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))", "#9 \/usr\/local\/www\/zoneminder\/api\/app\/webroot\/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))", "#10 {main}" ] }, "queryLog": [] } }
Can anyone suggest a starting point for troubleshooting?

Thanks,
Everett

User avatar
knight-of-ni
Posts: 2241
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: ZoneMinder 1.32.3 Freenas API Failure

Post by knight-of-ni » Sat Mar 30, 2019 1:02 pm

The messages you posted are just warnings. They are not fatal, so that might not be the root cause of the API not working.

In any case, from what you posted, verify the files and folders mentioned in the message:
- /var/log/zm exists
- /var/log/zm is owned by the web account user
- /var/log/zm/cake_error.log exists
- /var/log/zm/cake_error.log is owned by the web account user
- /var/log/zm/error.log exists
- /var/log/zm/error.log is owned by the web account user

Once you establish that, if the API still does not work, check to see what it wrote to error.log and/or cake_error.log, and that will likely be what the real problem is.
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/

everettcomstock
Posts: 3
Joined: Thu Mar 28, 2019 10:11 pm

Re: ZoneMinder 1.32.3 Freenas API Failure

Post by everettcomstock » Sun Mar 31, 2019 10:12 pm

Knight, thanks for your reply.

I attempted to check the log files but realized those folders do not exist. I'm not great with FreeBSD, and I'm not sure if the directory structure is the same as Linux. I checked the root/var/log directory and there is no zm directory, and no log files that look as if they are related to zoneminder. I also checked the root/usr/local/var directory, but there is no logs directory, and no zm folder or logs.

This may just be a FreeBSD vs. Linux issue, and I may just be looking in the wrong location, or maybe the "www" account in my FreeBSD jail does not have the correct permissions to create the logs.

I'm going to continue my research. If you have any additional suggestions, I'll take all the help I can get.

Thanks!
Everett

everettcomstock
Posts: 3
Joined: Thu Mar 28, 2019 10:11 pm

Re: ZoneMinder 1.32.3 Freenas API Failure

Post by everettcomstock » Wed Apr 03, 2019 12:22 pm

Knight,

I just wanted to follow up. My issues turned out to be related to incomplete configuration. I had not configured a server on the servers page, and I believe my HTTPS / Reverse Proxy configuration was confusing a few parts of the app.

However, as soon as I created a server entry, the API started working (and an issue with events not showing on the monitor view was also resolved).

Thank you very much for your help!
Everett

tsr966
Posts: 1
Joined: Tue Dec 10, 2019 4:17 pm

Re: ZoneMinder 1.32.3 Freenas API Failure

Post by tsr966 » Fri Dec 13, 2019 4:39 pm

How did you set up the server info to get the API to work?

oizo
Posts: 1
Joined: Fri Feb 14, 2020 9:11 pm

Re: ZoneMinder 1.32.3 Freenas API Failure

Post by oizo » Fri Feb 14, 2020 9:17 pm

Hi,

just wanted to leave som input. In my case, I tried using ZMninja from iOS and Mac OS. The APIs were not working.

I read what knight-of-ni posted and the /var/log/zm directory was missing. I created the directory and changed ownership to www:www, with

Code: Select all

chown -R www:www /var/log/zm
and restarted Zoneminder, now everything works relating to ZMNinja.

I get a strange URL-rewrite error when checking out http://<myserver>/zm/api. I don't mind as long as everything else works =)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests