php errors on webui (gentoo) zoneminder 1.9.1

Forum for questions and support relating to the 1.29.x releases only.
Post Reply
undrwater
Posts: 13
Joined: Thu Apr 07, 2016 4:17 am

php errors on webui (gentoo) zoneminder 1.9.1

Post by undrwater » Fri Apr 08, 2016 5:26 pm

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.

User avatar
iconnor
Posts: 829
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by iconnor » Sat Apr 09, 2016 1:19 pm

Interesting. Looks like we could use some better error logging, like where is it looking... I will do that.

User avatar
iconnor
Posts: 829
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by iconnor » Sat Apr 09, 2016 2:49 pm

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.

undrwater
Posts: 13
Joined: Thu Apr 07, 2016 4:17 am

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by undrwater » Mon Apr 11, 2016 1:48 am

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

undrwater
Posts: 13
Joined: Thu Apr 07, 2016 4:17 am

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by undrwater » Fri Apr 15, 2016 7:45 pm

It's not showing the directory it's looking in. Interesting to me as I would expect it to. Any ideas?

undrwater
Posts: 13
Joined: Thu Apr 07, 2016 4:17 am

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by undrwater » Fri Apr 22, 2016 8:11 pm

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.

raydude
Posts: 56
Joined: Sun Jul 21, 2013 6:09 pm

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by raydude » Sat Dec 17, 2016 9:22 am

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 );
}

undrwater
Posts: 13
Joined: Thu Apr 07, 2016 4:17 am

Re: php errors on webui (gentoo) zoneminder 1.9.1

Post by undrwater » Mon Jan 30, 2017 6:14 pm

Thank you @raydude! That works.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest