This thread looks helpful: https://forums.zoneminder.com/viewtopic.php?t=26131EDITING THIS POST AS I MAKE DISCOVERIES . . .
Has anyone had any luck getting the API's to work?
I'll look into it as well.
This thread looks helpful: https://forums.zoneminder.com/viewtopic.php?t=26131EDITING THIS POST AS I MAKE DISCOVERIES . . .
Has anyone had any luck getting the API's to work?
In addition to @danb35 's answer, putting the data outside the jail allows you to set a quota and reserved space for the dataset and will allow ZoneMinder's auto file delete function to work within space less than the entire pool. That seems important for this application, since it's constantly recording to the pool.
This thread looks helpful: https://forums.zoneminder.com/viewtopic.php?t=26131
I'll look into it as well.
I saw this thread, but it's a bit above my pay grade. I'm really good at following directions, moving around directories and typing what I'm told to type. But, "installing the binary version of pecl-APCu4" is not enough for me to go on!!!
I'll keep digging, though. Because I enjoy learning this "stuff". Let me know if you have success!
Unfortunately, no. I’m currently running ZoneMinder in a VM running Ubuntu. I couldn’t get the API’s to work in a standard jail. Everything works beautifully in the VM.Did you get any further on this?
I cannot get the API to work.
I've tried on NGINX and it just complains about the cgi-bin folder and with Apache it complains about API.
I’m sitting on a plane waiting for takeoff, so I don’t have access to my server, but I do remember that I had to remove the forward slash in front of the cgi-bin path definition found under their ZM Paths tab to get everything to work nicely.Did you get any further on this?
I cannot get the API to work.
I've tried on NGINX and it just complains about the cgi-bin folder and with Apache it complains about API.
Could not open config file.
Also This command Confused me quite a bit, I'm wondering if you meant:# nano /usr/local/etc # nano apache24/httpd.conf
# nano /usr/local/etc/apache24/httpd.conf service mysql-server start mysql -uroot -p < /usr/local/share/zoneminder/db/zm_create.sql And mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"The command as you quoted it indicated the user was in the /usr/local/etc/ directory at the time the command was issued, which would be equivalent to what you did.Also This command Confused me quite a bit, I'm wondering if you meant:
# nano /usr/local/etc/apache24/httpd.conf
This thread looks helpful: https://forums.zoneminder.com/viewtopic.php?t=26131
I'll look into it as well.
Could not open config file
I was having the same problem, spent 2 days trying to figure out a solution, finally found out that when I ranHaving a problem viewing the live stream. Seems to be recording fine.
Socket /var/run/zm/zms-804575s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly.
Any advice?
EDIT: I found the solution:
In /usr/local/etc/apache24/httpd.conf you need to find the lines
Code:<IfModule mpm_prefork_module> #LoadModule cgi_module libexec/apache24/mod_cgi.so </IfModule>
And remove the #.
ThenCode:service apache24 restart
I now have live video feed.
$ apachectl -M | grep cgi cgi_module (shared)
2018-07-14 18:47:42.709973 zmc_m2 102340 INF IPD-E17T08: 5000 - Capturing at 14.93 fps zm_monitor.cpp 3125 2018-07-14 18:47:35.541476 web_js 5176 ERR getStreamCmdResponse stream error: Socket /var/run/zm/zms-475533s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. - checkStreamForErrors() ?view=watch 2018-07-14 18:47:35.469921 web_php 5144 ERR Socket /var/run/zm/zms-475533s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. includes/functions.php 2033
nano /usr/local/etc/apache24/httpd.conf #LoadModule rewrite_module libexec/apache2/mod_rewrite.so nano /usr/local/www/zoneminder/api/.htaccess
nano /usr/local/www/zoneminder/api/app/.htaccess
nano /usr/local/www/zoneminder/api/app/webroot/.htaccessIfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] RewriteBase /zm/api </IfModule>
Another reason, not so much with Zonefinder, is that you may want your data accessible to other jails or other machines on the network. This particularly applies to media files. Since FreeNAS already has tested sharing mechanisms it seems easier to do this in a dataset accessible to FreeNAS than try to share the files directly from a jail.The less that's stored inside the jail, the easier it is to rebuild the jail if necessary. If you look at some of the recent how-to documents for iocage jails (e.g., https://forums.freenas.org/index.ph...unifi-controller-with-lets-encrypt-iocage.81/ or https://forums.freenas.org/index.php?resources/fn11-jailed-crashplan-pro-with-vnc-iocage.79/), they're even putting the config files outside of the jail, so that the only thing stored in the jail itself is the actual software. That means you can destroy the jail and rebuild it with the latest software, even upgrading the underlying OS template, without disturbing your data or configuration.
There's also the fact that some users (like me) put jails on a separate, smaller (sometimes SSD) pool, and wouldn't want the large amount of data taking space on the smaller pool.
mod_php71 and php71-mysqli in the pkg install command in step 2C.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/pdo.so' - Cannot open "/usr/local/lib/php/20131226/pdo.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/sockets.so' - Cannot open "/usr/local/lib/php/20131226/sockets.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/pdo_mysql.so' - Cannot open "/usr/local/lib/php/20131226/pdo_mysql.so" in Unknown on line 0
[Fri Sep 21 08:49:19.646446 2018] [:error] [pid 56782] [client 192.168.0.124:50791] PHP Fatal error: Class 'PDO' not found in /usr/local/www/zoneminder/includes/database.php on line 46
usr/local/lib/php/20160303/ and not /usr/local/lib/php/20131226/jls
# See what JID the Zoneminder jail is using, 35 in my case
jexec 35 /bin/tcsh
# Now we're in the jail. iocage also has a console feature, but it doesn't
# work well with nano or vi. At least for me, YMMV.
pkg update -f
pkg install apache24
sysrc apache24_enable=yes
service apache24 start
service apache24 stop
pkg install mysql56-server
service mysql-server start
sysrc mysql_enable=yes
service mysql-server start
mysql
service mysql-server stop
nano /usr/local/my.cnf
# Change the default of:
# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# to just:
# sql_mode=NO_ENGINE_SUBSTITUTION
service mysql-server start
mysql_secure_installation
sockstat -4
# The MySQL server is publically accessible, so that needs to be fixed
sysrc mysql_args="--bind-address=127.0.0.1"
service mysql-server restart
sockstat -4
nano /usr/local/etc/apache24/httpd.conf
pkg install zoneminder-h264
nano /usr/local/etc/php-fpm.conf
# I forget what I changed exactly here, it was in the install instructions
# that appeared after zoneminder was installed. Might not even be necessary
# since I used apache24 rather than nginx.
nano /usr/local/etc/php/ext-40-timezone.ini
# I added a line for PHP to give it the correct timezone
mysql -u root -p
# I created the databases and such, see the original post on this thread
mysql -u root -p zm < /usr/local/share/zoneminder/db/zm_create.sql
sysrc zoneminder_enable="YES"
service zoneminder start
service apache24 start
service apache24 stop
nano /usr/local/etc/apache24/Includes/httpd-vhosts.conf
# I put the virtual httpd server configuration here.
service apache24 restart
chmod 744 /usr/local/etc/zm.conf
cat /etc/passwd
chown mysql:mysql /usr/local/my.cnf
# MySQL will chmod my.cnf every time it runs, so you have to chown instead.
nano /usr/local/etc/apache24/httpd.conf
# I uncommented the lines that load the CGI modules
service apache24 restart
service mysql-server restart
service zoneminder restart
nano /usr/local/etc/apache24/Includes/php.conf
# I put the PHP specific httpd server config here
# I also ran into some trouble with PHP, turns out the zoneminder package
# specifically depends on php71. If you install php56 or php72 it's a mess.
# I had to debug quite a bit here, so my apologies if I've omitted anything.
pkg install php71-pdo-mysql
pkg install php71-mysqli
pkg install mod_php71
pkg install php71-mysql
pkg install php71-mysqli
service apache24 restart
service zoneminder restart
# At this point zoneminder was pretty much working for me.
# In the web interface update your paths for where everything is stored.
# If you mount a ZFS dataset then make sure it's in the web root or has
# a symbolic link, the Zoneminder web interface requires it to be accessible.
# The following are my final config files on my setup with comments stripped.
################################################################################
root@Zoneminder:/ # cat /usr/local/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
################################################################################
root@Zoneminder:/ # cat /usr/local/etc/apache24/httpd.conf
ServerRoot "/usr/local"
Listen 80
LoadModule mpm_prefork_module libexec/apache24/mod_mpm_prefork.so
LoadModule authn_file_module libexec/apache24/mod_authn_file.so
LoadModule authn_core_module libexec/apache24/mod_authn_core.so
LoadModule authz_host_module libexec/apache24/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache24/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache24/mod_authz_user.so
LoadModule authz_core_module libexec/apache24/mod_authz_core.so
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
LoadModule auth_basic_module libexec/apache24/mod_auth_basic.so
LoadModule reqtimeout_module libexec/apache24/mod_reqtimeout.so
LoadModule filter_module libexec/apache24/mod_filter.so
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule log_config_module libexec/apache24/mod_log_config.so
LoadModule env_module libexec/apache24/mod_env.so
LoadModule headers_module libexec/apache24/mod_headers.so
LoadModule setenvif_module libexec/apache24/mod_setenvif.so
LoadModule version_module libexec/apache24/mod_version.so
LoadModule unixd_module libexec/apache24/mod_unixd.so
LoadModule status_module libexec/apache24/mod_status.so
LoadModule autoindex_module libexec/apache24/mod_autoindex.so
<IfModule !mpm_prefork_module>
LoadModule cgid_module libexec/apache24/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
LoadModule cgi_module libexec/apache24/mod_cgi.so
</IfModule>
LoadModule dir_module libexec/apache24/mod_dir.so
LoadModule alias_module libexec/apache24/mod_alias.so
LoadModule php7_module libexec/apache24/libphp7.so
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf
<IfModule unixd_module>
User www
Group www
</IfModule>
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/usr/local/www/apache24/data"
<Directory "/usr/local/www/apache24/data">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "/var/log/httpd-error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "/var/log/httpd-access.log" common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/usr/local/www/apache24/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/usr/local/www/apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
TypesConfig etc/apache24/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include etc/apache24/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include /usr/local/etc/apache24/Includes/*.conf
################################################################################
root@Zoneminder:/ # cat /usr/local/etc/php-fpm.conf
[global]
pid = run/php-fpm.pid
include=/usr/local/etc/php-fpm.d/*.conf
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
env[PATH] = /usr/local/bin:/usr/bin:/bin
################################################################################
root@Zoneminder:/ # cat /usr/local/etc/php/ext-40-timezone.ini
date.timezone = America/New_York
################################################################################
root@Zoneminder:/ # cat /usr/local/etc/apache24/Includes/httpd-vhosts.conf
<VirtualHost *:80>
ServerName Zoneminder
DocumentRoot "/usr/local/www/zoneminder-h264/"
<Directory "/usr/local/www/zoneminder-h264">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ScriptAlias /cgi-bin "/usr/local/www/zoneminder-h264/cgi-bin"
<Directory "/usr/local/www/zoneminder-h264/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
################################################################################
root@Zoneminder:/ # cat /usr/local/etc/apache24/Includes/php.conf
<IfModule dir_module>
DirectoryIndex index.php index.html
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>