i'm running Zoneminder v1.32.3 on Alpine Linux with Nginx and PHP7. Everything's working fine so far but API access. The Crud plugin wasn't installed on Alpine (just a dead symlink pointing to a crud-c3976f1478c681b0bbc132ec3a3e82c3984eeed5 folder. That's a very old crud version anyway). So i fixed it by doing this with latest versions (Crud 3.2.0 into api/app/Plugin/Crud and cakephp-2.10.18 into api/lib).
Now, when i open /zm/api i get this error:
Code: Select all
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): Use of undefined constant ZM_OPT_USE_AUTH - assumed 'ZM_OPT_USE_AUTH' (this will throw an Error in a future version of PHP) [APP/Controller/AppController.php, line 72]
Warning (2): require_once(../../../includes/auth.php) [<a href='http://php.net/function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory [APP/Controller/AppController.php, line 73]
Fatal error: require_once() [function.require]: Failed opening required '../../../includes/auth.php' (include_path='.:/usr/share/php7') in /usr/share/webapps/zoneminder/htdocs/api/app/Controller/AppController.php on line 73
My guess is that CakePHP is not running properly due to nginx not configured properly. I've mainly taken the config from here and here. It currently looks like this:
Code: Select all
server {
listen 80 default_server;
listen [::]:80 default_server;
root /usr/share/webapps/zoneminder/htdocs;
location /cgi-bin {
gzip off;
alias /usr/share/webapps/zoneminder/cgi-bin;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.sock;
}
location /zm {
gzip off;
alias /usr/share/webapps/zoneminder/htdocs;
index index.php;
location ~ \.php$ {
if (!-f $request_filename) { return 404; }
expires epoch;
include fastcgi_params;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php-fpm7/php-fpm.sock;
}
location ~* /zm/.*\.(txt|log)$ {
deny all;
}
location ~* /zm/.*\.(m4a|mp4|mov)$ {
mp4;
mp4_buffer_size 5M;
mp4_max_buffer_size 10M;
}
location /zm/api/ {
alias /usr/share/webapps/zoneminder/htdocs/api;
rewrite ^/zm/api(.+)$ /zm/api/index.php?p=$1 last;
}
}
}
When i look at the current Apache config i see several rewrites and aliases at the bottom for api/app/webroot and api/app that are related to /zm/api. I'm wondering if i have to handle this on nginx as well. I guess the initial script that sets the ROOT path (or something) is not invoked at all. But i obviously need a hand here.
Any idea how to fix this?