Page 1 of 1

php errors on webui (gentoo) zoneminder 1.9.1

Posted: Fri Apr 08, 2016 5:26 pm
by undrwater
The errors are as follows:
Warning: disk_total_space(): No such file or directory in /usr/share/zoneminder/www/includes/functions.php on line 1670

Warning: disk_free_space(): No such file or directory in /usr/share/zoneminder/www/includes/functions.php on line 1671

Warning: Division by zero in /usr/share/zoneminder/www/includes/functions.php on line 1671
This relates to the events folder. The install is fresh and everything seems to work aside from those errors. If I set a camera to modect, images will show up in the events folder.

Here is some info:

Code: Select all

zoneminder www # pwd
/usr/share/zoneminder/www

zoneminder www # ls -l
total 52
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 ajax
drwxr-xr-x 4 apache apache 4096 Apr  7 13:15 api
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 css
lrwxrwxrwx 1 root   root     26 Apr  7 13:15 events -> /var/lib/zoneminder/events
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 graphics
lrwxrwxrwx 1 root   root     26 Apr  7 13:15 images -> /var/lib/zoneminder/images
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 includes
-rw-r--r-- 1 root   root   6435 Apr  7 13:12 index.php
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 js
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 lang
drwxr-xr-x 3 apache apache 4096 Apr  5 15:45 skins
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 temp
drwxr-xr-x 3 apache apache 4096 Apr  5 15:45 tools
drwxr-xr-x 2 apache apache 4096 Apr  7 13:15 views

Code: Select all

zoneminder zoneminder # pwd
/var/lib/zoneminder

zoneminder zoneminder # ls -l
total 8
drwxrwxr-x 4 apache apache 4096 Apr  6 16:24 events
drwxrwxr-x 2 apache apache 4096 Apr  6 17:19 images
zoneminder zoneminder # 
Google returns some results for these errors, but the solution is usually that the events directory has been moved or did not exist. I'm wondering if perhaps there's something specific to gentoo (most of these errors came up on gentoo machines), or perhaps I'm missing something.

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Sat Apr 09, 2016 1:19 pm
by iconnor
Interesting. Looks like we could use some better error logging, like where is it looking... I will do that.

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Sat Apr 09, 2016 2:49 pm
by iconnor
Edit /usr/share/zoneminder/www/includes/functions.php

Make the getDiskPercent function look like this:
function getDiskPercent()
{
$total = disk_total_space(ZM_DIR_EVENTS);
if ( ! $total ) {
Error("disk_total_space returned false for " . ZM_DIR_EVENTS );
return 0;
}
$space = round(($total - disk_free_space(ZM_DIR_EVENTS)) / $total * 100);
return( $space );
}

This should cause it to output the directory that it is looking in.

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Mon Apr 11, 2016 1:48 am
by undrwater
Here's what we get now:
Load: 0.09 / Disk:
Warning: disk_total_space(): No such file or directory in /usr/share/zoneminder/www/includes/functions.php on line 1670
0%
In the log I get:
disk_total_space returned false for events

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Fri Apr 15, 2016 7:45 pm
by undrwater
It's not showing the directory it's looking in. Interesting to me as I would expect it to. Any ideas?

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Fri Apr 22, 2016 8:11 pm
by undrwater
Just wanted to bump this as I've updated my system, but still running into the problem (?) detailed above. iconnor, any other ideas? I don't see any issues with this (yet), so it's not a major deal, but wondering in case it is.

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Sat Dec 17, 2016 9:22 am
by raydude
I fixed this by changing the routine to this:

Code: Select all

function getDiskPercent() {
  $total = disk_total_space(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
  if ( ! $total ) {
    Error("disk_total_space returned false for " . ZM_PATH_WEB.'/'.ZM_DIR_EVENTS );
    return 0;
  }
  $free = disk_free_space(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
  if ( ! $free ) {
    Error("disk_free_space returned false for " . ZM_PATH_WEB.'/'.ZM_DIR_EVENTS );
  }
  $space = round(($total - $free) / $total * 100);
  return( $space );
}

Re: php errors on webui (gentoo) zoneminder 1.9.1

Posted: Mon Jan 30, 2017 6:14 pm
by undrwater
Thank you @raydude! That works.