Zoneminder 1.30.4 installed on Debian 9.4.
Cake error messages were being output to /var/log/zmerror.log and thus causing permission errors.
I hacked it by editing this file: /usr/share/zoneminder/www/api/app/Config/bootstrap.php
And changing the below config setting to add the trailing slash to the directory path. That allowed Cake to output to /var/log/zm/error.log.
This could possibly be fixed where the code concatenates 'error.log' but for now this works for me.
CakeLog::config('custom_path', array(
'engine' => 'File',
'path' => '/var/log/zm/'
));