Warning (2): Use of undefined constant ZM_OPT_USE_API - assumed 'ZM_OPT_USE_API' (this will throw an Error in a future version of PHP) [APP/Controller/AppController.php, line 63]
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]
CakePHP: the rapid development php framework
Fatal Error
Error: require_once() [<a href='http://php.net/function.require'>function.require</a>]: Failed opening required '../../../includes/config.php' (include_path='.:/usr/share/php7:/usr/share/php')
File: /usr/share/zoneminder/www/api/app/Config/bootstrap.php
Line: 123
Notice: If you want to customize this error message, create app/View/Errors/fatal_error.ctp
CakePHP: the rapid development php framework
CakePHP 2.10.8
Warning (2): Use of undefined constant ZM_DB_USER - assumed 'ZM_DB_USER' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_PASS - assumed 'ZM_DB_PASS' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_NAME - assumed 'ZM_DB_NAME' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_SSL_CA_CERT - assumed 'ZM_DB_SSL_CA_CERT' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_SSL_CLIENT_KEY - assumed 'ZM_DB_SSL_CLIENT_KEY' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_SSL_CLIENT_CERT - assumed 'ZM_DB_SSL_CLIENT_CERT' (this will throw an Error in a future version of PHP) [CORE/Cake/Model/ConnectionManager.php, line 69]
Warning (2): Use of undefined constant ZM_DB_HOST - assumed 'ZM_DB_HOST' (this will throw an Error in a future version of PHP) [APP/Config/database.php, line 92]
Warning (2): Use of undefined constant ZM_DB_HOST - assumed 'ZM_DB_HOST' (this will throw an Error in a future version of PHP) [APP/Config/database.php, line 101]
you must identify which version of CakePHP and CRUD you have in your ZM setup.
change what you done back to it's original code. go look in /usr/share/zoneminder/www/api/app/Plugin/Crud/README.md
(or the path to your ZM installation) At the top of this file it should have :
# Version notice
This version of Crud is for CakePHP 2.x.
This fork has been patched for PHP 7.2 compatibilty, specifically for the [ZoneMinder](https://github.com/ZoneMinder/ZoneMinder) project.
This fork will no longer be necessary once [Pull Reqeust #282](https://github.com/FriendsOfCake/crud/pull/582) has been merged.
if not, you might have the version CRUD and CakePHP that isn't fixed to work with PHP 7.2+
the correct versions are here at this link and can be swapped in manually with relative ease.
Thank you! I was struggling with the same API error with Ubuntu 18.04.01 LTS and 1.32.3. I didn't need any of the code changes in that forum post -- the code fix and CakePHP plugin files were already present on my system. I only needed these updates to my Apache2 config:
# For better visibility, the following directives have been migrated from the
# default .htaccess files included with the CakePHP project.
# Parameters not set here are inherited from the parent directive above.
<Directory "/usr/share/zoneminder/www/api">
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app">
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app/webroot">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /zm/api
</Directory>