Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
adot
Posts: 8
Joined: Sat Apr 08, 2017 10:06 am

Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by adot » Fri Sep 14, 2018 4:57 pm

Hey,

after (manually) upgrading to 1.32 all runs smooth so far besides API.
CakePHP complains it cannot access "Mysql" and throws
Notice (8): Use of undefined constant ZM_DB_SSL_CA_CERT - assumed 'ZM_DB_SSL_CA_CERT' [CORE/Cake/Model/ConnectionManager.php, line 69]
Notice (8): Use of undefined constant ZM_DB_SSL_CLIENT_KEY - assumed 'ZM_DB_SSL_CLIENT_KEY' [CORE/Cake/Model/ConnectionManager.php, line 69]
Notice (8): Use of undefined constant ZM_DB_SSL_CLIENT_CERT - assumed 'ZM_DB_SSL_CLIENT_CERT' [CORE/Cake/Model/ConnectionManager.php, line 69]

which is due to the new zm.conf file now brings these 3 vars to configure.
Was not able to find in wiki, forum or docs any hint how to configure - and why. My DB is in the same isolated net and not SSL_secured?!
Help appreciated.
A.

bbunge
Posts: 2435
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by bbunge » Fri Sep 14, 2018 6:27 pm

You may have to remove the entry in the my.cnf file that was for Zoneminder 1.30.4. The database has been "fixed" so that entry is not needed.

In the [mysqld] section remove the following for ZM 1.32.0

sql_mode = NO_ENGINE_SUBSTITUTION

However, the install package for 1.32.0 has been removed from the PPA and this is one thing I have not tested.

adot
Posts: 8
Joined: Sat Apr 08, 2017 10:06 am

Re: Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by adot » Sun Sep 16, 2018 10:39 am

Done.
Issue fixed! Requires zoneminder restart to show effect.

This also might have solved my load related issues reported here:
viewtopic.php?f=38&t=27521

A.

sadams54
Posts: 21
Joined: Thu Sep 27, 2018 1:09 am

Re: Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by sadams54 » Thu Oct 18, 2018 9:57 pm

I tried this fix and removed that option in the my.cnf and the problem either remained or got worse. Had to put it back. I do not like that I have to treat zoneminder 1.32 so carefully. Seems the whole version is seriously unstable.

kkalbaugh
Posts: 4
Joined: Thu Jul 28, 2016 6:04 pm

Re: Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by kkalbaugh » Sun Nov 04, 2018 8:38 pm

I am having the same problem and removing from /etc/mysql/my.cnf

sql_mode = NO_ENGINE_SUBSTITUTION

didn't help.

I have 3 installs of this and this is the only location with an SSL cert. Here's what /api/monitors.json reports.
Notice (8): Use of undefined constant ZM_DB_SSL_CA_CERT - assumed 'ZM_DB_SSL_CA_CERT' [CORE/Cake/Model/ConnectionManager.php, line 69]
Notice (8): Use of undefined constant ZM_DB_SSL_CLIENT_KEY - assumed 'ZM_DB_SSL_CLIENT_KEY' [CORE/Cake/Model/ConnectionManager.php, line 69]
Notice (8): Use of undefined constant ZM_DB_SSL_CLIENT_CERT - assumed 'ZM_DB_SSL_CLIENT_CERT' [CORE/Cake/Model/ConnectionManager.php, line 69]
{ "code": 500, "name": "Database connection "Mysql" is missing, or could not be created.", "message": "SQLSTATE[HY000] [2006] MySQL server has gone away", "url": "\/zm\/api\/monitors.json" }
Anyone else have luck figuring this out?

jackie666
Posts: 1
Joined: Wed Dec 05, 2018 8:34 pm

Re: Upgrade 1.30.4 -> 1.32 API issue accessing Mysql

Post by jackie666 » Wed Dec 05, 2018 8:47 pm

I had the same problem after upgrading Ubuntu to 18.0.4 (which wrecked a bunch of other stuff too, argh.) I noticed that the 1.32 version of /etc/zm/zm.conf has a couple of new entries and if you choose the apt-defaults, it will continue to use the old zm.conf (the new one will be named zm.conf.dpkg-dist):

Code: Select all

...
# SSL CA certificate for ZoneMinder database
ZM_DB_SSL_CA_CERT=

# SSL client key for ZoneMinder database
ZM_DB_SSL_CLIENT_KEY=

# SSL client cert for ZoneMinder database
ZM_DB_SSL_CLIENT_CERT=
There's also a dire warning about using the ZM_SERVER_HOST var, which wasn't present in older versions:

Code: Select all

# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=
After I added these new directives into the current zm.conf file (I also unset ZM_SERVER_HOST variable as well) and restarted ZM/logged back in, https://myzmserver/zm/api/monitors.json started showing the monitors properly again. As I don't have any certs active for the DB, I just left all the ZM_DB_* vars as empty.

Note: Prior to all this, I also disabled the sql_mode directive in /etc/mysql/my.cnf as well.

Post Reply

Who is online

Users browsing this forum: ris2t and 4 guests